Crontab Tutorial:
A crontab file consists of lines of six fields each. The
fields are separated by spaces or tabs. The first five are
integer patterns that specify the following:
minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).
Each of these patterns may be either an asterisk (meaning
all legal values) or a list of elements separated by commas.
An element is either a number or two numbers separated by a
minus sign (meaning an inclusive range). Note that the
specification of days may be made by two fields (day of the
month and day of the week). Both are adhered to if speci-
fied as a list of elements. See EXAMPLES.
The sixth field of a line in a crontab file is a string that
is executed by the shell at the specified times. A percent
character in this field (unless escaped by \) is translated
to a NEWLINE character.
To view your crontab file:
crontab -l
To edit your crontab file:
crontab -e
(By default this uses vi as an editor, to use a different editor (emacs):
"setenv EDITOR emacs" )
To remove your crontab file:
crontab -r
EXAMPLES:
Here's how you would run the program log.pl located in /usr/home/eric at
different times:
3:15am every weekday morning:
15 3 * * 1-5 /usr/home/eric/log.pl
The first and fifteenth of each month:
0 0 1,15 * * /usr/home/eric/log.pl
Every Monday
0 0 * * 1 /usr/home/eric/log.pl
The first and fifteenth of each month and every monday:
0 0 1,15 * 1 /usr/home/eric/log.pl
|
|