Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
User Commands (c) crontab(1)
• 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.
Note that days can be specified by two fields (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 first and fifteenth days of each month, as well as
every Monday. To specify days by only one field, the other field should contain an *
(asterisk).
The cron program runs the command named in the sixth field at the selected date and
time. If you include a % (percent sign) in the sixth field, cron treats everything that pre-
cedes it (in that field) as the command invocation, and makes all that follows it available
to the standard input file, unless you escape the percent sign (\%) or double quote it
("%"). A % (percent sign) in the sixth field is translated to a newline character.
Note that the shell runs only the first line of the command field (up to a % or End-of-
Line). All other lines are made available to the command as the standard input file.
Note also that blank lines and lines whose first nonblank character is # (pound sign) are
treated as comments and ignored by cron.
The cron program invokes a subshell from your $HOME directory. This means that it
will not run your .profile file. If you schedule a command to run when you are not
logged in and you want to have commands in your .profile run, you must explicitly do so
in the crontab file. (For a more detailed discussion of how sh can be invoked, see the sh
command.)
Environment Variables
The cron program supplies a default environment for every shell, defining HOME, LOGNAME,
SHELL (=/bin/sh), and PATH (=:/bin:/bin/unsupported:).
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 file entries.
a. To write the time to the file every hour on the hour, enter:
0****echo The hour is ‘date‘.>/datefile
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 > /calfile
527188-004 Hewlett-Packard Company 2−75