CRONTAB(5) — FILE FORMATS
NAME
crontab − table of times to run periodic jobs
SYNOPSIS
/var/spool/cron/crontabs/∗
DESCRIPTION
The cron utility is a permanent process, started by /etc/rc.local. cron consults the files in the directory /var/spool/cron/crontabs to find out what tasks are to be done, and at what time.
Each line in a crontab file consists of six fields, separated by spaces or tabs, as follows:
minuteshoursday-of-monthmonthday-of-weekcommand
minutes Minutes field, which can have values in the range 0 through 59.
hours Hours field, which can have values in the range 0 through 23.
day-of-month Day of the month, in the range 1 through 31.
month Month of the year, in the range 1 through 12.
day-of-week Day of the week, in the range 0 through 6. Sunday is day 0 in this scheme of things. For backward compatibility with older systems, Sunday may also be specified as day 7.
command Command to be run. A percent character in this field (unless escaped by \) is translated to a NEWLINE character. Only the first line (up to a % or end of line) of the command field is executed by the Shell. The other lines are made available to the command as standard input.
Any of fields 1 through 5 can be a list of values separated by commas. A value can either be a number, or a pair of numbers separated by a hyphen, indicating that the job is to be done for all the times in the specified range. If a field is an asterisk character (∗) it means that the job is done for all possible values of the field.
Note: the specification of days may be made by two fields (day of the month and day of the week). If both are specified as a list of elements, both are adhered to. For example,
0 0 1,15 ∗ 1
would run a command on the first and fifteenth of each month, as well as on every Monday. To specify days by only one field, the other field should be set to ∗. For example,
0 0 ∗ ∗ 1
would run a command only on Mondays.
The command is run from your home directory with an arg0 of sh. Users who desire to have their .profile executed must explicitly do so in the command. cron supplies a default environment for every shell, defining HOME, LOGNAME, USER, SHELL(=/bin/sh), and PATH(=:/usr/ucb:/bin:/usr/bin).
NOTE: Users should remember to redirect the standard output and standard error of their commands! If this is not done, any generated output or errors will be mailed to the user.
Lines that start with # are treated as comments.
EXAMPLES
0 0 ∗ ∗ ∗ calendar −
15 0 ∗ ∗ ∗ /usr/etc/sa −s >/dev/null
15 4 ∗ ∗ ∗ find /var/preserve −mtime +7 −a −exec rm −f {} ;
40 4 ∗ ∗ ∗ find / −name ’#∗’ −atime +3 −exec rm −f {} ;
0 0 ∗ ∗ 1-5 /usr/local/weekdays
0 0 ∗ ∗ 0,6 /usr/local/weekends
The calendar command runs at minute 0 of hour 0 (midnight) of every day. The /usr/etc/sa command runs at 15 minutes after midnight every day. The two find commands run at 15 minutes past four and at 40 minutes past four, respectively, every day of the year. The /usr/local/weekdays command is run at midnight on weekdays. Finally, the /usr/local/weekends command is run at midnight on weekends.
FILES
/var/spool/cron/crontabs/∗
tables of times to run periodic jobs
/etc/rc.local
.profile
SEE ALSO
Solbourne Computer, Inc. — 12 Dec 1990