Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)

crontab(1) OSS Shell and Utilities Reference Manual
Two numbers separated by a dash to indicate an inclusive range.
A list of numbers, separated by commas, which selects all numbers in the list.
An asterisk, meaning all legal values.
Days can be specied by two elds (day of the month and day of the week). If you
specify both as a list of elements, both are adhered to. For example, the following entry:
0 0 1,15 * 1 command
would run command at midnight on the rst and fteenth days of each month, as well as
every Monday. To specify days by only one eld, the other eld should contain an *
(asterisk).
The cron program runs the command named in the sixth eld at the selected date and
time. If you include a % (percent sign) in the sixth eld, cron treats everything that pre-
cedes it (in that eld) as the command invocation, and makes all that follows it available
to the standard input le, unless you escape the percent sign (\%) or double quote it
("%"). A % (percent sign) in the sixth eld is translated to a newline character.
The shell runs only the rst line of the command eld (up to a % or End-of-Line). All
other lines are made available to the command as the standard input le.
Blank lines and lines whose rst nonblank character is # (pound sign) are treated as com-
ments and ignored by cron.
The cron program invokes a subshell from your $HOME directory. It will not run your
.prole le. If you schedule a command to run when you are not logged in and you want
to have commands in your .prole run, you must explicitly do so in the crontab le.
(For a more detailed discussion of how you can invoke sh, see the sh command.)
Environment Variables
The cron program supplies a default environment for every shell, dening HOME, LOGNAME,
SHELL (=/bin/sh), and PATH (=:/bin:/bin/unsupported:/usr/bin).
This command supports the use of the EDITOR, LANG, LC_ALL, LC_CTYPE,
LC_MESSAGES, and NLSPATH environment variables.
EXAMPLES
The following examples show valid crontab le entries.
a. To write the time to the le every hour on the hour, enter:
0****echo The hour is date.>/datele
This example uses command substitution. (For more information, see the sh
command.)
b. To run cal at 6:30 a.m. every Monday, Wednesday, and Friday, enter:
30 6 * * 1,3,5 cal > /calle
c. To dene text for the standard input le to a command, enter:
0 16 10-31 12 5 wall %HAPPY HOLIDAYS% Drive safely%
This writes a message at 4:00 p.m. each Friday between December 10 and 31 to
all users logged in.
The text following the rst % (percent sign) denes the standard input le to the
280 Hewlett-Packard Company 527188-007