crontab(1)

crontab(1)

NAME

crontab - user job ®le scheduler

SYNOPSIS

crontab [®le]

crontab -e [username]

crontab -l [username]

crontab -r [username]

DESCRIPTION

The crontab command manages a crontab ®le for the user. You can use a crontab ®le 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 ®le by copying the speci®ed ®le, or standard

 

input if ®le is omitted or - is speci®ed as ®le , into the crontab directory,

 

/var/spool/cron/crontabs. The name of your crontab ®le in the

 

crontab directory is the same as your effective user name.

crontab -e [username]

Edit a copy of the user's crontab ®le, or create an empty ®le to edit if the crontab ®le does not exist. When editing is complete, the ®le will be copied into the crontab directory as the user's crontab ®le.

crontab -l [username]

Lists the user's crontab ®le.

crontab -r [username]

Remove the user's crontab ®le 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 ®le of the speci®ed user.

The entries in a crontab ®le are lines of six ®elds each. The ®elds are separated by spaces or tabs. The lines have the following format:

minute hour monthday month weekday command

The ®rst ®ve are integer patterns that specify when the sixth ®eld, command, should be executed. They can have the following ranges of values:

minute

The minute of the hour, 0−59

hour

The hour of the day, 0−23

monthday

The day of the month, 1−31

month

The month of the year, 1−12

weekday

The day of the week, 0−6, 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 speci®cation of days can be made in two ®elds: monthday and weekday. If both are speci®ed in an entry, they are cumulative. For example,

0 0 1,15 * 1 command

runs command at midnight on the ®rst and ®fteenth of each month, as well as every Monday. To specify days in only one ®eld, set the other ®eld to asterisk (*). For example,

0 0 * * 1 command

runs command only on Mondays.

The sixth ®eld, command (the balance of a line including blanks in a crontab ®le), is a string that is executed by the shell at the speci®ed times. A percent character (%) in this ®eld (unless escaped by a backslash (\)) is translated to a newline character, dividing the ®eld into "lines". Only the ®rst "line" (up to a % or end-of-line) of the command ®eld is executed by the shell. Any other "lines" are made available to the command as standard input.

HP-UX Release 11i: December 2000

− 1 −

Section 1−125

c