@reboot on cron not working

Hello ! I have Openwrt 23.05.2 on EdgeRouter X.
I have set the following two lines on crontab:

@reboot sleep 90 && /etc/config/bin/restoreStats.sh
@reboot sleep 90 && echo "Subject: ERX rebooted." | msmtp xx@gmail.com

In this restoreStats.sh there is sshfs used (restoreStats restores data for luci app statistics saved in a USB stick on my raspberry pi). I first started with sleep 60, and it didn't work, so I raised it to 90. But it's still not working. I really think 90 seconds should be enough for everything to be ready, so I wonder if there is something else which is wrong. I would appreciate it very much if someone could please let me know what I have done wrong.

@reboot on cron not working

Have you compiled a personal enhanced version of busybox?

Like wiki says:
https://openwrt.org/docs/guide-user/base-system/cron#task_specification

Time shortcuts are not enabled by default. Shortcuts require compiling busybox with FEATURE_CROND_SPECIAL_TIMES enabled in the busybox compile options.

3 Likes

@hnyman thank you for your reply ! Oh no, I don't even know what a busy box is! But that explains ! Then I'm just going to set a time or perhaps a script that would do that job.

If you just want something launched at boot, you can enter those lines into /etc/rc.local
That is the intended place for special startup actions.

1 Like

@hnyman thanks for the hint ! That sounds easy enough for me to do. On rc.local, it says "exit 0". Should I put the lines before that, or after ?

Before that

3 Likes

@IMEVER It worked. Thanks !!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.