Like tron and not kron, or chron cron Like tron and not kron, or chron
And crontabs… Like the windows task scheduler Unix’s have a traditional job scheduling daemon named cron $crontab is the command used to display/edit a user’s crontab file
Each user has their own One crontab per user stored in /var/spool/cron/crontabs This directory is not typically open for user viewing Users can edit their file with a $crontab –e command
File must use a special record layout Format is generally ‘at this time on this date run this command’ MM HH DM MN WK Command Minutes Hour DayofMonth Month DayofWeek
Here are some sample records #comments in file begin with a ‘#’ # run five minutes after midnight, every day 5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1 # run at 2:15pm on the first of every month -- output mailed to paul 15 14 1 * * $HOME/bin/monthly # run at 10 pm on weekdays, annoy Joe 0 22 * * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%
More examples #using a ‘-’ to mean all values in between #adding a ‘/2’ means to skip values 23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday“ #using either ‘sun’ or 0 or 7 for Sunday 5 4 * * 0 echo "run at 5 after 4 every sunday" 5 4 * * sun echo "run at 5 after 4 every sunday"
Commands $crontab –e #edit user’s crontab file $crontab –l #list user’s crontab file If you’re logged in as root and would like to view or edit a user’s file, #crontab –u <username> -l or -e