Scheduler
crond scans the CRONTAB file every minute and checks every line to determine if the specified time/date information matches the current time/date. If they are equal, the command line specified will be executed.
Enabling cron can be done via web interface via the Admin>Services tab.
Toggling this radio button will change the following configuration entry in /etc/xap-livebox.ini with 1 being enabled and missing or 0 being disabled.
[cron] enable=1
Timezones
To make sure you are running cron in the right timezone you'll need to setup the /etc/TZ file.
# echo GMT0BST-1 >/etc/TZ
If you are on the EAST coast of the US you would use
# echo EST5EDT4 >/etc/TZ
See for more examples http://wiki.openwrt.org/doc/uci/system
crontabs
You create and configure your crontab entries by using the crontab command line program. The command “crontab -e” will open the editor vi by default.
# crontab
BusyBox v1.12.1 (2011-11-30 14:38:56 EST) multi-call binary
Usage: crontab [-c DIR] [-u USER] [-ler]|[FILE]
-c Crontab directory
-u User
-l List crontab
-e Edit crontab
-r Delete crontab
FILE Replace crontab by FILE ('-': stdin)
They will be created and stored in /etc/crontabs if you wish to back them up.
There are several helper scripts that allow you to send xAP messages.
bscmsg- will send an xAPBSC.cmd messagealiasmsg- will send aclass=aliaspayload in keeping withxap-googlecalandxap-twitterbehaviour. This can be in turn processed by an alias Lua plugboard applet.
Both of these scripts are written in Lua and are installed into /usr/bin on your system, so you can browse the source and use them as starters for your own scripts.
For example aliasmsg will send this message with %s being substituted for the argument you supply to the script.
xap-header
{
class=alias
}
command
{
text=%s
}
A sample crontab might look like. Using bscmsg we are turning an RF unit On at 7:00am and Off an 7:01am, transposing this to 8am and using the aliasmsg script we can do a similar thing.
0 7 * * * bscmsg -t dbzoo.livebox.controller:rf.1 -s on 1 7 * * * bscmsg -t dbzoo.livebox.controller:rf.1 -s off 0 8 * * * aliasmsg "rf 1 on" 1 8 * * * aliasmsg "rf 1 off"
Want to wake a machine using Wake-on-LAN? This entry would send a WoL packet to the specified MAC address at 7am Mon-Fri.
0 7 * * 1-5 ether-wake -i br0 3c:d9:2b:5b:67:c2
The helper scripts can be run from the command line to test that you have got the correct syntax before putting this same command line string into a crontab.
# bscmsg
bscmsg:missing required parameter: t
Various flags and option types
-t (string) xAPBSC Target
-s (onoff) xAPBSC State
-x xAPBSC Text
-l xAPBSC Level
#
Kinda obvious, but when testing, be sure to check that the date on your Livebox is correctly set. At the command prompt 'date' will show you the current date/time.
