cronie/man/crontab.1

238 lines
6.4 KiB
Groff
Raw Normal View History

2017-05-08 15:30:03 +02:00
.\"/* Copyright 1988,1990,1993 by Paul Vixie
.\" * All rights reserved
.\" */
2019-08-06 18:08:05 +02:00
.\"
2017-05-08 15:30:03 +02:00
.\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
.\" Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" Modified 2010/09/12 by Colin Dean, Durham University IT Service,
.\" to add clustering support.
.\"
.\" $Id: crontab.1,v 1.7 2004/01/23 19:03:32 vixie Exp $
.\"
2021-08-09 15:08:54 +02:00
.TH CRONTAB 1 "2019-10-29" "cronie" "User Commands"
2017-05-08 15:30:03 +02:00
.SH NAME
crontab \- maintains crontab files for individual users
.SH SYNOPSIS
.B crontab
.RB [ -u
2019-08-06 18:08:05 +02:00
.IR user ]
.RI < "file"
.RB | \ - >
2017-05-08 15:30:03 +02:00
.br
.B crontab
.RB [ -u
.IR user ]
2019-08-06 18:08:05 +02:00
.RB < -l " | " -r " | " -e >\ [ -i ]
2017-05-08 15:30:03 +02:00
.RB [ -s ]
.br
.B crontab
2019-08-06 18:08:05 +02:00
.BR -n \ [
2017-05-08 15:30:03 +02:00
.IR "hostname " ]
.br
.B crontab
.BR -c
2019-08-06 18:08:05 +02:00
.br
.B crontab
.BR -V
2017-05-08 15:30:03 +02:00
.SH DESCRIPTION
.I Crontab
2019-08-06 18:08:05 +02:00
is the program used to install a crontab table
.IR file ,
remove or list the existing tables used to serve the
2017-05-08 15:30:03 +02:00
.BR cron (8)
2019-08-06 18:08:05 +02:00
daemon. Each user can have their own crontab, and though these are files
in
2017-05-08 15:30:03 +02:00
.IR /var/spool/ ,
2019-08-06 18:08:05 +02:00
they are not intended to be edited directly. For SELinux in MLS mode,
you can define more crontabs for each range. For more information, see
2017-05-08 15:30:03 +02:00
.BR selinux (8).
.PP
In this version of
.IR Cron
it is possible to use a network-mounted shared
2019-08-06 18:08:05 +02:00
.I /var/spool/cron
2017-05-08 15:30:03 +02:00
across a cluster of hosts and specify that only one of the hosts should
2019-08-06 18:08:05 +02:00
run the crontab jobs in the particular directory at any one time. You
may also use
2021-08-09 15:08:54 +02:00
.BR crontab
2019-08-06 18:08:05 +02:00
from any of these hosts to edit the same shared set of crontab files, and
to set and query which host should run the crontab jobs.
2017-05-08 15:30:03 +02:00
.PP
2021-08-09 15:08:54 +02:00
Scheduling cron jobs with
.BR crontab
can be allowed or disallowed for different users. For this purpose, use the
2017-05-08 15:30:03 +02:00
.I cron.allow
and
.I cron.deny
2019-08-06 18:08:05 +02:00
files. If the
2017-05-08 15:30:03 +02:00
.I cron.allow
2021-08-09 15:08:54 +02:00
file exists, a user must be listed in it to be allowed to use
.BR crontab .
If the
2017-05-08 15:30:03 +02:00
.I cron.allow
file does not exist but the
.I cron.deny
2019-08-06 18:08:05 +02:00
file does exist, then a user must
.I not
be listed in the
2017-05-08 15:30:03 +02:00
.I cron.deny
2021-08-09 15:08:54 +02:00
file in order to use
.BR crontab.
If neither of these files exist, then only the super user is allowed to use
.BR crontab .
.PP
Another way to restrict the scheduling of cron jobs beyond
.BR crontab
is to use PAM authentication in
2019-08-06 18:08:05 +02:00
.I /etc/security/access.conf
to set up users, which are allowed or disallowed to use
2021-08-09 15:08:54 +02:00
.BR crontab
2017-05-08 15:30:03 +02:00
or modify system cron jobs in the
2019-08-06 18:08:05 +02:00
.IR /etc/cron.d/
2017-05-08 15:30:03 +02:00
directory.
.PP
2019-08-06 18:08:05 +02:00
The temporary directory can be set in an environment variable. If it is
not set by the user, the
2017-05-08 15:30:03 +02:00
.I /tmp
directory is used.
.PP
.SH "OPTIONS"
.TP
.B "\-u"
2019-08-06 18:08:05 +02:00
Specifies the name of the user whose crontab is to be modified. If this
option is not used,
2021-08-09 15:08:54 +02:00
.BR crontab
2017-05-08 15:30:03 +02:00
examines "your" crontab, i.e., the crontab of the person executing the
2019-08-06 18:08:05 +02:00
command. If no crontab exists for a particular user, it is created for
2021-08-09 15:08:54 +02:00
them the first time the
2017-05-08 15:30:03 +02:00
.B crontab -u
2021-08-09 15:08:54 +02:00
command is used under their username.
2017-05-08 15:30:03 +02:00
.TP
.B "\-l"
Displays the current crontab on standard output.
.TP
.B "\-r"
Removes the current crontab.
.TP
.B "\-e"
2019-08-06 18:08:05 +02:00
Edits the current crontab using the editor specified by the
.I VISUAL
or
.I EDITOR
environment variables. After you exit from the editor, the modified
crontab will be installed automatically.
2017-05-08 15:30:03 +02:00
.TP
.B "\-i"
2019-08-06 18:08:05 +02:00
This option modifies the
2017-05-08 15:30:03 +02:00
.B "\-r"
2019-08-06 18:08:05 +02:00
option to prompt the user for a 'y/Y' response before actually removing
the crontab.
2017-05-08 15:30:03 +02:00
.TP
.B "\-s"
2019-08-06 18:08:05 +02:00
Appends the current SELinux security context string as an MLS_LEVEL
setting to the crontab file before editing / replacement occurs - see the
documentation of MLS_LEVEL in
.BR crontab (5).
2017-05-08 15:30:03 +02:00
.TP
.B "\-n"
This option is relevant only if
.BR cron (8)
2019-08-06 18:08:05 +02:00
was started with the
.B \-c
option, to enable clustering support. It is used to set the host in the
cluster which should run the jobs specified in the crontab files in the
2017-05-08 15:30:03 +02:00
.I /var/spool/cron
2019-08-06 18:08:05 +02:00
directory. If a hostname is supplied, the host whose hostname returned
by
.BR gethostname (2)
2017-05-08 15:30:03 +02:00
matches the supplied hostname, will be selected to run the selected cron jobs subsequently. If there
is no host in the cluster matching the supplied hostname, or you explicitly specify
an empty hostname, then the selected jobs will not be run at all. If the hostname
is omitted, the name of the local host returned by
2019-08-06 18:08:05 +02:00
.BR gethostname (2)
2017-05-08 15:30:03 +02:00
is used. Using this option has no effect on the
.I /etc/crontab
file and the files in the
.I /etc/cron.d
directory, which are always run, and considered host-specific. For more
information on clustering support, see
2019-08-06 18:08:05 +02:00
.BR cron (8).
2017-05-08 15:30:03 +02:00
.TP
.B "\-c"
This option is only relevant if
.BR cron (8)
2019-08-06 18:08:05 +02:00
was started with the
.B \-c
option, to enable clustering support. It is used to query which host in
the cluster is currently set to run the jobs specified in the crontab
files in the directory
2017-05-08 15:30:03 +02:00
.I /var/spool/cron
2019-08-06 18:08:05 +02:00
, as set using the
.B \-n
option.
.TP
.B "\-V"
Print version and exit.
2021-08-09 15:08:54 +02:00
.SH CAVEATS
The files
.I cron.allow
and
.I cron.deny
cannot be used to restrict the execution of cron jobs; they only restrict the
use of
.BR crontab .
In particular, restricting access to
.BR crontab
has no effect on an existing
.I crontab
of a user. Its jobs will continue to be executed until the crontab is removed.
.PP
The files
.I cron.allow
and
.I cron.deny
must be readable by the user invoking
.BR crontab .
If this is not the case, then they are treated as non-existent.
2017-05-08 15:30:03 +02:00
.SH "SEE ALSO"
2019-08-06 18:08:05 +02:00
.BR crontab (5),
.BR cron (8)
2017-05-08 15:30:03 +02:00
.SH FILES
.nf
/etc/cron.allow
/etc/cron.deny
.fi
.SH STANDARDS
The
.I crontab
2019-08-06 18:08:05 +02:00
command conforms to IEEE Std1003.2-1992 (``POSIX'') with one exception:
For replacing the current crontab with data from standard input the
.B \-
has to be specified on the command line. This new command
syntax differs from previous versions of Vixie Cron, as well as from the
classic SVR3 syntax.
2017-05-08 15:30:03 +02:00
.SH DIAGNOSTICS
2019-08-06 18:08:05 +02:00
An informative usage message appears if you run a crontab with a faulty
command defined in it.
2017-05-08 15:30:03 +02:00
.SH AUTHOR
2019-08-06 18:08:05 +02:00
.MT vixie@isc.org
Paul Vixie
.ME
.br
.MT colin@colin-dean.org
Colin Dean
.ME