7919 questions

9344 answers

15054 comments

12869 members

0 votes
572 views 5 comments
by
Hello,

I have set a cronjob to start after reboot like this

@reboot /mnt/mmcblk0p1/myscript.sh >> /mnt/mmcblk0p1/log.txt 2>&1

It doesn't start, however if I set it to start at cerzain time like

45 13 * * * /mnt/.....

Then it does work, so I'm quite confused.

Any help would be appreciated.

Thank you

3 Answers

+1 vote
by
Hello,

If you are running a command at boot, I think best way to do that would be to use User Scripts and not crontab, it runs a file /etc/rc.local every boot.

But if you want to keep using crontab, I would recommend giving router some time to boot and add sleep function in your script for a minute or two.
Best answer
by
Thank you it worked when I added my command to rc.local file, also I read that if you want to run an endless loop you should add an ampersand at the end of command otherwise the device cannot boot so I did and it worked normally.
by
Edit: the anonymous comment is from me, I forgot to login.
0 votes
by

Hello,

use this customized version of busybox it contains some advanced functionnalities of crontab [Link removed]

put the .ipk file in /tmp/

and type these following commands :

#opkg update

#opkg install /tmp/busybox_1.30.1-2_ar71xx_crontab_ipk

ps: i compiled it from the GPL source.

by
Thank you for your advice. The above answer worked for me already and I will try yours as well asap and will report back.
by

Please, be very careful when adding custom packages from unknown users / repositories unless you are confident that package does not contain any security holes left on purpose / accidentally.

@mm2019 It would be best that you would mention what additional functionalities your package contains as well as link to the source code of your package so users can audit the code. Until then, I am removing the link.

0 votes
by

Hello

@Peasant

There is no security hole regarding this package i have myself made the cross-compilation from the teltonika's GPL https://wiki.teltonika-networks.com/gpl/RUT9XX_R_GPL_00.06.06.1.tar.gz . There are a couple months ago and it works well.

Here are the functionnalities(yellow) i added:

by

Thank you for your efforts and insights, we will add additional crontab features to our nice-to-have features list and in the future they might become available in our firmware out of the box.

I recompiled the package with additional crontab functionality according to your screenshot and @reboot seems to work correctly. (Only special times feature is necessary for @reboot to work, but it won't hurt enabling other two, because package size seems to be the same in the end and someone may find them useful)

Again, thank you.

busybox_1.30.1-2_ar71xx.ipk