A visual guide to the crontab file

I sometimes need to remind myself how to edit that crontab file … today I found a great little graphic on the Linuxconfig wiki that sums it up nicely:

The values in the crontab file

Sometimes, I also pipe the stdout and stderr somewhere (like “/usr/local/sbin/backup.sh >>/var/logs/backups.log 2>/var/logs/backups.err“) if I want to avoid getting emails with the output from cron … (although in the example above, which looks like a backup script, I’d probably rather be emailed with a warning that my backups were succeeding or failing).

Thanks Linuxconfig !

Update:

After some FriendFeed discussion, it was noted that the crontab above is a “system crontab”, not the typical “user crontab” you would edit by typing “crontab -e” at the command line. For the “user crontab”, you don’t specify the user (the blue field, “root” in the example above).

4 thoughts on “A visual guide to the crontab file

  1. Your graphic is not correct: the graphic says to run the job every Sunday (day = 0) yet it shows Saturday (day = 7). Might want to edit better.

    Just a thought.

    DC

  2. Actually, checking the man page for crontab, it turns out that both (day = 0) and (day = 7) are Sunday ! Seems superfluous to me, but such are the quirks of Unix. Maybe there is an interesting story behind it.

    (oh, and I can’t lay claim to the graphic … it’s from the Linuxconfig wiki, as linked in the post. I just thought it was worth highlighting).

    Cheers !

Leave a Reply

Your email address will not be published. Required fields are marked *