156 lines
4.6 KiB
Groff
156 lines
4.6 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g1.crontab @(#)crontab 30.4 of 3/4/86
|
|
.nr X
|
|
.if \nX=0 .ds x} CRONTAB 1 "User Environment Utilities" "\&"
|
|
.if \nX=1 .ds x} CRONTAB 1 "User Environment Utilities"
|
|
.if \nX=2 .ds x} CRONTAB 1 "" "\&"
|
|
.if \nX=3 .ds x} CRONTAB "" "" "\&"
|
|
.TH \*(x}
|
|
'\" t
|
|
.SH NAME
|
|
crontab \- user crontab file
|
|
.SH SYNOPSIS
|
|
.B crontab
|
|
[file]
|
|
.br
|
|
.B crontab
|
|
\f3\-r\f1
|
|
[file]
|
|
.br
|
|
.B crontab
|
|
\f3\-l\f1
|
|
[file]
|
|
.br
|
|
.B crontab
|
|
\f3\-e\f1
|
|
[file]
|
|
.SH DESCRIPTION
|
|
.I crontab
|
|
copies the specified file,
|
|
or standard input if no file is specified,
|
|
into a directory that holds all users' crontabs.
|
|
The \-r option removes a user's crontab from the crontab directory.
|
|
\f2crontab\fP \-l will list the crontab file for the
|
|
invoking user. The -e option spawns an editor which contains the
|
|
user's current crontab (as output by crontab -l), and automatically
|
|
updates the crontab when the user saves the file and exits the
|
|
editor. The name of the editor to invoke can be specified by the
|
|
environment variable VISUAL or EDITOR; else, vi is used by default.
|
|
.PP
|
|
Normal users may only remove, list, or edit their own crontab files
|
|
which is the default. The superuser (root) may supply any username
|
|
following \f3\-r\f1, \f3\-l\f1, or \f3\-e\f1 to remove, list, or edit
|
|
that user's crontab.
|
|
.PP
|
|
If the file
|
|
.B /etc/cron.d/cron.allow
|
|
exists, only users whose names appear in the file are permitted to use
|
|
.I crontab.
|
|
This restriction applies to all users, including root.
|
|
If that file does not exist,
|
|
the file
|
|
.B /etc/cron.d/cron.deny
|
|
is checked to determine if the user
|
|
should be denied access to
|
|
.I crontab.
|
|
If neither file exists, only root is allowed to
|
|
submit a job.
|
|
If \f3cron.allow\f1 does not exist and \f3cron.deny\f1 exists but is
|
|
empty, global usage is permitted.
|
|
The allow/deny files consist of one user name
|
|
per line.
|
|
.PP
|
|
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:
|
|
.sp
|
|
.br
|
|
minute (0\-59),
|
|
.br
|
|
hour (0\-23),
|
|
.br
|
|
day of the month (1\-31),
|
|
.br
|
|
month of the year (1\-12),
|
|
.br
|
|
day of the week (0\-6 with 0=Sunday).
|
|
.sp
|
|
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).
|
|
If both are specified as a list of elements,
|
|
both are adhered to.
|
|
For example, 0 0 1,15 \(** 1 would run a command on the
|
|
first and fifteenth of each month, as well as on every Monday.
|
|
To specify days by only one field,
|
|
the other field should be set to \(**
|
|
(for example, 0 0 \(** \(** 1 would run a command only on Mondays).
|
|
.PP
|
|
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
|
|
\f3\e\fP)
|
|
is translated to a new-line
|
|
character.
|
|
Only the first line (up to a % or end of line)
|
|
of the command field is executed by the shell.
|
|
The other lines are made available to the
|
|
command as standard input.
|
|
.PP
|
|
The shell is invoked from your
|
|
.B \s-1$HOME\s+1
|
|
directory with an
|
|
.BR arg0 " of " sh.
|
|
Users who desire to have their \f2.profile\fP executed must
|
|
explicitly do so in the crontab file.
|
|
.I Cron
|
|
supplies a default environment for every shell, defining
|
|
\f3\s-1HOME\s+1, \s-1LOGNAME\s+1, \s-1USER\s+1, \s-1SHELL\s+1(=/bin/sh),\f1
|
|
\f3PATH(=/usr/sbin:/usr/bsd/:/usr/bin:/bin/:/etc:/usr/etc), \f1and \f3TZ\f1.
|
|
.PP
|
|
If you do not redirect the standard output
|
|
and standard error of your commands,
|
|
any generated output or errors
|
|
will be mailed to you.
|
|
.PP
|
|
Any errors encountered while parsing the crontab file (or stdin) will cause
|
|
.I crontab
|
|
to abort with no changes being made to any existing crontab.
|
|
.SH FILES
|
|
.ta 2.75i
|
|
/etc/cron.d main cron directory
|
|
.br
|
|
/var/spool/cron/crontabs spool area
|
|
.br
|
|
/var/cron/log accounting information
|
|
.br
|
|
/etc/cron.d/cron.allow optional list of allowed users
|
|
.br
|
|
/etc/cron.d/cron.deny list of denied users
|
|
.br
|
|
/etc/cron.d/FIFO to communicate crontab changes to \fIcron\fP
|
|
.SH "SEE ALSO"
|
|
sh(1), cron(1M)
|
|
.SH NOTES
|
|
If you inadvertently enter the
|
|
.B crontab
|
|
command with no argument(s), you may exit without overwriting the existing
|
|
crontab entry either by generating an interrupt (typically by typing ^C or
|
|
DEL), or by providing empty input (typically by typing ^D on the first empty
|
|
line).
|
|
.PP
|
|
If a job is scheduled during the 'witching hour' - the time during
|
|
a change from the main to alternate time zone, the job will either be
|
|
run once (if the actual time exists twice) or not at all (if the actual time never exists).
|
|
.Ee
|