crond is a daemon that executes commands that need to be run regularly according to some schedule. Theschedule and corresponding commands are stored in the file /etc/crontab.Each entry in the /etc/crontab file entry contains six fields separated by spaces or tabs in the following form:
minute hour day_of_month m onth weekday command
These fields accept the following values:minute 0 through 59 hour 0 through 23 day_of_month 1 through 31 month 1 through 12 weekday 0 (Sun)through 6 (Sat) command a shell commandYou must specify a value for each field. Except for the command field, these fields can contain the following:
•
A number in the specified range, e.g. to run a command in May, specify 5 in the
month
field.
Two numbers separated by a dash to indicate an inclusive range, e.g. to run a cron job on Tuesdaythrough Friday, place 2-5 in the
weekday
field.
•
A list of numbers separated by commas, e.g. to run a command on the first and last day of January, youwould specify 1,31 in the
day_of_month
field.
•
* (asterisk), meaning all allowed values, e.g. to run a job every hour, specify an asterisk in the
hour
field.You can also specify some execution environment options at the top of the /etc/crontab file:SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=rootTo run the calendar command at 6:30am. every Mon, Wed, and Fri, a suitable /etc/crontab entry would be:30 6 * * 1,3,5 /usr/bin/calendar The output of the command will be mailed to the user specified in the MAILTO environment option.You don't need to restart the cron daemon crond after changing /etc/crontab - it automatically detects changes.
What is a crond? What is its use?
Reviewed by enakta13
on
November 22, 2012
Rating: