Wiki
Clone wikirt-n56u / EN / UsingCron
Using cron
This firmware has built-in cron daemon which can be handy to run scheduled jobs (periodically).
- Go to
Administration > Services
WebUI page, - Turn on
Cron Daemon (Scheduler)?
switch, - Edit
Scheduler tasks (Crontab)
field, - Press
Apply
.
Crontab field has the following syntax:
00 06 * * * ether-wake -i br0 XX:XX:XX:XX:XX:XX
00 06 * * *
is the time to execute job (equals to "run every day at 06:00AM"), ether-wake -i br0 XX:XX:XX:XX:XX:XX
is the command to execute (wake up some PC with XX:XX:XX:XX:XX:XX MAC address). You can find details here.
Note
Please note, this daemon inherits $PATH
variable from firmware (without /opt/bin
or /opt/sbin
), so you have to place full path to every executable outside of firmware. To avoid this, use shell wrapper /etc/storage/cron/shell-wrapper.sh
:
#!/bin/sh # Pull $PATH and other settings from /etc/profile and /opt/etc/profile . /etc/profile # Shell keywords shouldn't have a "-c" prefix [ "$1" = "-c" ] && shift # Call cron job SHELL=/bin/sh eval $@
chmod +x /etc/storage/cron/shell-wrapper.sh
SHELL=/etc/storage/cron/shell-wrapper.sh
Thanks to @themiron for debugging shell wrapper script.
Updated