M | T | W | T | F | S | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Recent Posts
Archives
- January 2016 (2)
- October 2014 (2)
- September 2014 (15)
Live and Learn
No additional software needs to be installed on OpenWrt, as it already has the crond binary included.
Cron jobs need to be specified in /etc/crontabs/root. For now, just create an empty file:
# touch /etc/crontabs/root
Create a symbolic link to the crontab file:
# ln -sf /etc/crontabs/root /etc/crontab
it allows me to reference the crontab file using /etc/crontab.
Enable and start crond:
# /etc/init.d/crond start # /etc/init.d/crond enable
Verify that crond successfully started by checking the syslog using:
# logread
and you should see something similar to this at the end of the logread output
Sep 11 17:26:40 OpenWrt cron.info crond[634]: crond: crond (busybox 1.19.4) started, log level 8
Now that you have crond running on OpenWrt, it can be used to periodically run any task that you want. Just add an entry to/etc/crontab for each task that you want periodically executed.
For example, if you want to run a script (/usr/bin/demo) daily at 23:30, the following would be added to crontab:
30 23 * * * /usr/bin/demo >/dev/null 2>&1
Restart crond to make this change take effect:
# /etc/init.d/cron restart
Recent Comments