Thursday, July 02, 2009

Crontab

Ok, it's time to refreshing my memory about the Crontab, here is what should remember when adding or editing a crontab.

* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)


Example command are:

0 0 1 * * /usr/bin/rsync -avrt rsync://archive.fedoraproject.org/pub/archive/fedora/linux/updates/8/i386/ --exclude=debug/ /data/repo/fedora/updates/8/i386

This will run rsync for every month: first minute, hour and date in that month.