Cron What?

4 replies [Last post]
allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011

Well, I didn't think that I was thick until I started trying to use the HAH livebox. But having struggled my way to getting a system running trying to use Google calendar to schedule appliance switching with pretty limited success, I was looking forward to a simple scheduling system, which was what cron/tab appeared to be.

Unfortunately it appears that I really am too thick to work it out. In spite of reading the wiki several times, reading the Wikipedia items and reading the forum posts related to the beta firmware I am simply unable to understand what on earth I'm supposed to do with it.

If I issue the command "/usr/bin/bscmsg -t dbzoo.livebox.controller:rf.2 -s on" then the appropriate rf command is issued.

If I do anything with the command crontab like crontab 0 20 * * * /usr/bin/bscmsg -t dbzoo.livebox.controller:rf.2 -s then I get an "illegal option --t" response. I've tried other forms of the command which result in "can't open 'root' no such file or directory", I've created a file /etc/crontabs/crontab or /etc/crontabs/CRONTAB which contains the the same text string but nothing happens. I can't create, edit or list anything. I'm sure that I must be missing something which others find glaringly obvious but after 2 hours of mind numbing frustration I really am about to throw in the towel.

If anybody has an idiots guide rather than a wiki then perhaps some others may be grateful as well, but for now I'm going to lie down in a darkened room with a large bevarage!

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Have you upgraded to 297 yet?

Have you upgraded to 297 yet?  Assuming you are, you will need to enable the cron service through the web interface, it's under the Admin->Services tab.  After that login as root and issue crontab -e to start editing the root crontab file, this uses the unix vi editor.  

Hope this helps, I'm online most of tonight if you want to work it through until you get it going.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
crontab

The command "crontab -e" is used to open the editor VI to edit your crontab.  It is in the editor you enter a crontab line.

This command will list the crontab

# crontab -l
0 7 * * 1-5 ether-wake -i br0 3c:d9:2b:5b:67:c2
#

As the only user on the system is root the file created will /etc/crontabs/root which will be effectively the output for crontab -l

I'm sort of assuming people are mildly familar with unix based concepts.

Brett

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Thanks for the clarification.

Thanks for the clarification. The crucial point that I missed was that issuing the command "crontab -e" would not only edit but actually CREATE the required file.

The very first line in the wiki says "crond scans the file CRONTAB every minute and checks every line" which set me off on completely the wrong track. In fact the file which it scans is /etc/crontabs/root. Had that been obvious to me it is likely that the files which I had created would have worked.

Astonishing how a piece missing from a jigsaw makes the picture completely wrong :-(

 

P.S. Hope this saves someone else the trouble that I had.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
A technical clarification

crond scans ALL the files in the directory /var/spool/cron/crontabs/

As /var resides on a memory based filesystem that is created on startup by the /etc/rc.d/rc.sysinit script you will find that /var/spool/cron/crontabs is a linkage to /etc/crontabs so that your configurations persist across reboots.

# cd /var/spool/cron/
# ls -l
lrwxrwxrwx    1 root     root           13 Dec 31  1969 crontabs -> /etc/crontabs
#

Each user of the HAH will have a file named after their username.  The HAH only has 1 user "root" so the only file you will see will be /var/spool/cron/crontabs/root or /etc/crontabs/root (where it really lives)

A little more wierdness for your amusement.

Brett

Hardware Info