Topic: Cron broken in new update

I was having a problem with getting a cron job to work on the Chumby after the update. I have two issues I have spotted on this. The first maybe specific to me, is that root's crontab "/psp/crontabs/root" suddenly owned by chumby:chumby

chumby:/psp/crontabs# ls -al /psp/crontabs/root 
-rw-r--r--    1 chumby     chumby           152 Nov 13 10:04 /psp/crontabs/root

Crond rightfully doesn't like this, as a security measure, so doesn't run any of root's cron jobs. As I say this maybe specific to me. Chown'ing to root:root fixed for me.

The second issue is that the crontab program seems to have been compiled to look at the wrong place for cronjobs

chumby:/psp/crontabs# crontab -l
crontab: can't open 'root': No such file or directory

strace crontab -l
munmap(0x4001f000, 4096)                = 0
chdir("/var/spool/cron/crontabs")       = 0
open("root", O_RDONLY|O_LARGEFILE)      = -1 ENOENT (No such file or diretory)

It's looking in /var/spool/cron not where they are /etc/cron/crontabs which is symlinked to /psp/crontabs

The way round this is obviously to play at being crontab manually edit the file then touch /psp/crontabs/cron.update.

Anyone else see these two issues?

Re: Cron broken in new update

Same problems here (both). I tried making a symlink in /var/spool/cron to /psp/crontabs but it doesn't survive a reboot. 

This is going to require a bit more work to figure out how to get my custom cron jobs to run again...

Re: Cron broken in new update

Adding a custom cron job works for me by just editing the file /psp/crontabs/root and then touching /psp/crontabs/cron.update.  This update file will then get deleted when crond notices it (within an minute) and will then reload the crontab. Oh and check that /psp/crontabs/root is owned by root:root and isn't world writeable.

A bit messy though, it just looks mainly like crontab was compiled pointing at the wrong path.

Re: Cron broken in new update

I found that crontab -c /psp/crontabs -e is the easiest way to edit the crontab. No need to touch cron.update.

Re: Cron broken in new update

I too had problems when I tried adding cron jobs to put my Chumby One into night mode in the evenings and wake up in the mornings. I tried like a hundred different things, but maybe the key was the ownership of the crontab (thanks simpfeld!). Is this a bug in the Chumby distro?

crontab -l doesn't work, since cron is running from a non-standard directory. You must run it with -c too:

chumby:~# crontab -l
crontab: can't open 'root': No such file or directory
chumby:~# ps aux | grep cron
 1496 root       0:00 /usr/sbin/crond -c /etc/cron/crontabs -S
 9710 root       0:00 grep cron
chumby:~# crontab -l -c /etc/cron/crontabs/
0 3 * * * /usr/chumby/scripts/
* * * * * /usr/chumby/scripts/flashplayer_watchdog
0 23 * * * /psp/
0 7 * * * /psp/

Re: Cron broken in new update

Was your /psp/crontabs/root owned by chumby:chumby too? Just to see it wasn't something I'd done.

If so, I'm guessing a problem with the distro, and I'd also guess the standard cron jobs won't be running either for most people either.

Re: Cron broken in new update

Yes, I think it was owned by chumby:chumby. I was messing around some before I found this thread, but I can't imagine that anything I did should have changed the ownership in that way.

Do the moderators read all posts? Can someone confirm that this is a real bug?

Re: Cron broken in new update

We read every post.

Engineering is looking into this.

Re: Cron broken in new update

On my Chumby 8 I have also to use

crontab -c /psp/crontabs -e

to edit my crontabs. But my cron job doesn't really work. That is what I met as crontab:

36 20 * * * python /mnt/usb/calLib/ --server https:[...] > /mnt/storage/local/cron.log

This is a python script that reads some caldav files and writes them into a file on my usb-drive. I can execute it exactly like this from the command line and it works fine. But the cron job doesn't write the file with the caldav infos and also doesn't write the log-file.
What can I do?

Re: Cron broken in new update

Chances are that it doesn't know where python is - the cron jobs are run in a shell that may not have the same environment variable set.  You will probably have to be explicit about the PATH and various library variables.

I would suggest putting a path to a simple script in the cron table, and fully resolved paths for anything non-standard in the script itself.