Cron

How can I tell if Cron is working? I cannot find any Cron logs and a simple test failed:

* * * * * echo “Cron Test $(date)” >> /DataVolume/crontest.txt

This link may be helpful:  http://mybookworld.wikidot.com/forum/t-395036

Do this via SSH:

MyBookLive:~# ps aux | grep -i cron
root 2436 0.0 0.7 5120 1792 ? SNs Jan18 0:16 /usr/sbin/cron
root 18528 0.0 0.9 6976 2496 pts/0 S+ 11:49 0:00 grep -i cron

 If you see /usr/sbin/cron listed, cron is running.

I don’t know if it works with user-installed crontab files (crontab -e) or if you can only modify the existing crontab files in /etc/cron*.

Yeah I already tried that (both). I think the current firmware might be using Anacron instead. Any ideas?

Can someone please try in crontab, or crond, etc?:

* * * * * echo “Cron Test $(date)” >> /DataVolume/crontest.txt

I only let it run for a few iterations, but it’s working fine for me…

MyBookLive:~# crontab -e
crontab: installing new crontab
MyBookLive:~# crontab -l
# m h dom mon dow command
* * * * * echo "Cron Test $(date)" >> /DataVolume/crontest.txt
MyBookLive:~# tail -f /DataVolume/crontest.txt
Cron Test Sat Feb 11 16:10:01 CST 2012
Cron Test Sat Feb 11 16:11:01 CST 2012

I get the following:

MyBookLive:~# crontab -l

no crontab for root

…that’s after you finish doing contab -e?

Sorry, No I didn’t do crontab -e.

I thought that I could just edit the exisiting crontab.

Does this mean I need to install a new one to make it work?

Who is the cron user for other cron tasks then if it’s not root?

You just answered your own question.

If you’re modfiying the in-build CRONTAB files, YOU must specify the user.

Your example did not:

* * * * *  echo “Cron Test $(date)” >> /DataVolume/crontest.txt

Here’s what it should look like: 

MyBookLive:/etc# cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
* * * * * root echo "Cron Test $(date)" >> /DataVolume/crontest.txt
#



MyBookLive:/etc# cat /DataVolume/crontest.txt
Cron Test Mon Feb 13 06:58:01 CST 2012
Cron Test Mon Feb 13 06:59:01 CST 2012
Cron Test Mon Feb 13 07:00:02 CST 2012