Cron Notes
Here's the format
.---------------- minute (0 - 59) | .------------- hour (0 - 23) | | .---------- day of month (1 - 31) | | | .------- month (1 - 12) OR jan,feb,mar,apr ... | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat | | | | | * * * * *
Notes...
a star means every value, so start in minute means every minute... Sooo...
* * * 1,7 * /biannual.backupscript #this ran every minute on jan 1 and july 1 0 0 1 1,7 * /biannual.backupscript #specify a 12:00 am on the first of the month
Easy examples
$crontab -e * * * * 0 /usr/local/sbin/myscripts/mycrontabs/backupWeekly * * 1 * * /usr/local/sbin/myscripts/mycrontabs/backupMonthly * * 1,15 * * /usr/local/sbin/myscripts/mycrontabs/backupFtp
Edit cron jobs for this user
crontab -e
Edit cron jobs for the system
vi /etc/cron
Cron will send error messages to the user who run the script!
Run at 7:30 mon-fri
30 7 * * 1-5 /home/john/crons/asdf