A crontab file consists of commands, one per line, that execute automatically at the time specified by the first five fields at the beginning of each command line. These first five fields, described in the following table, are separated by spaces. They indicate when the command will be executed.
Table 30-3 Values for crontab Time Fields
Time Field |
Values |
---|---|
Minute |
0-59 |
Hour |
0-23 |
Day of month |
1-31 |
Month |
1-12 |
Day of week |
0-6 (0 = Sunday) |
Follow these guidelines to use special characters in crontab time fields:
Use a space to separate each field.
Use a comma to separate multiple values.
Use a hyphen to designate a range of values.
Use an asterisk as a wildcard to include all possible values.
Use a comment mark (#) at the beginning of a line to indicate a comment or a blank line.
For example, the following sample crontab command entry displays a reminder in the user's console window at 4 p.m. on the first and fifteenth of every month.
0 16 1,15 * * echo Timesheets Due > /dev/console |
Each command within a crontab file must consist of one line, even if it is very long, because crontab does not recognize extra carriage returns. For more detailed information about crontab entries and command options, refer to crontab(1).