HP-UX Reference (11i v1 05/09) - 1 User Commands A-M (vol 1)

c
crontab(1) crontab(1)
NAME
crontab - user job file scheduler
SYNOPSIS
crontab [file]
crontab -e [username]
crontab -l [username]
crontab -r [username]
DESCRIPTION
The crontab command manages a crontab file for the user. You can use a crontab file to schedule jobs
that are executed automatically by
cron (see cron(1M)) on a regular basis. The command has four forms:
crontab [file] Create or replace your crontab file by copying the specified file,orstandard
input if file is omitted or - is specified as file , into the crontab directory,
/var/spool/cron/crontabs
. The name of your crontab file in the
crontab directory is the same as your effective user name.
crontab -e [username]
Edit a copy of the user’s crontab file, or create an empty file to edit if the
crontab file does not exist. When editing is complete, the file will be copied
into the crontab directory as the user’s crontab file.
crontab -l [username]
Lists the users crontab file.
crontab -r [username]
Remove the user’s crontab file from the crontab directory.
Only a privileged user can use username following the -e, -l, or -r options, to edit, list, or remove the cron-
tab file of the specified user.
The entries in a crontab file are lines of six fields each. The fields are separated by spaces or tabs. The
lines have the following format:
minute hour monthday month weekday command
The first five are integer patterns that specify when the sixth field, command, should be executed. They
can have the following ranges of values:
minute The minute of the hour,
059
hour The hour of the day, 023
monthday The day of the month, 131
month The month of the year, 112
weekday The day of the week, 06, 0=Sunday
Each pattern can be either an asterisk (*), meaning all legal values, or a list of elements separated by com-
mas. An element is either a number in the ranges shown above, or two numbers in the range separated by
a hyphen (meaning an inclusive range). Note that the specification of days can be made in two elds:
monthday and weekday. If both are specified in an entry, they are cumulative. For example,
0 0 1,15 * 1 command
runs command at midnight on the first and fifteenth of each month, as well as every Monday. To specify
days in only one field, set the other field to asterisk (*). For example,
00**1command
runs command only on Mondays.
The sixth field, command (the balance of a line including blanks in a crontab file), is a string that is exe-
cuted by the shell at the specified times. A percent character (%) in this field (unless escaped by a backslash
(\)) is translated to a newline character, dividing the field into "lines". Only the first "line" (up to a % or
end-of-line) of the command field is executed by the shell. Any other "lines" are made available to the com-
mand as standard input.
HP-UX 11i Version 1: September 2005 1 Hewlett-Packard Company Section 1125