LinuxInstruct: Tutorials: Setting up a Cron Job
By Brad Davis
Crontab is a useful program that allows you to execute a command when ever you want it to run. Crontab can be found on most, if not all, Linux and Unix systems.
Getting Started with Crontab...
Type crontab -e as the user that you want the Cron Job to be executed as.
The format of the job is like this. I'm gonna use some varibles, you should remember
those from algebra, for those of you that don't it is a letter that represents another
value (usually a number).
a b c d e f
where...
a = The minute after the hour that you want it done
b = The hour you want it done (Military Time)
c = Day of the Month
d = Month of the Year
e = Day of the week
f = 'command'
5 0 * * * /usr/local/bin/email
Like the above example, /usr/local/bin/email, will run every night at 12:05 AM.
The * means to run every instance of the value in the field. Like a asterisk in the day field means to run everyday
Other Useful crontab commands
crontab -e opens the editor
crontab -l lists the contents of the crontab
crontab -r removes the crontab
Return Home