man-pages/man1/crontab.1.html
2021-03-31 01:06:50 +01:00

257 lines
6.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of CRONTAB</TITLE>
</HEAD><BODY>
<H1>CRONTAB</H1>
Section: User Commands (1)<BR>Updated: 19 April 2010<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
crontab - maintain crontab files for individual users (Vixie Cron)
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
crontab [ -u user ] file
<BR>
crontab [ -u user ] [ -i ] { -e | -l | -r }
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<I>crontab</I>
is the program used to install, deinstall or list the tables
used to drive the
<I><A HREF="/cgi-bin/man/man2html?8+cron">cron</A></I>(8)
daemon in Vixie Cron. Each user can have their own crontab, and though
these are files in /var/spool/cron/crontabs,
they are not intended to be edited directly.
<P>
If the
<I>/etc/cron.allow</I>
file exists, then you must be listed (one user per line) therein in order to be
allowed to use this command. If the
<I>/etc/cron.allow</I>
file does not exist but the
<I>/etc/cron.deny</I>
file does exist, then you must <B>not</B> be listed in the
<I>/etc/cron.deny</I>
file in order to use this command.
<P>
If neither of these files exists, then depending on site-dependent
configuration parameters, only the super user will be allowed to use this
command, or all users will be able to use this command.
<P>
If both files exist then
<I>/etc/cron.allow</I>
takes precedence. Which means that
<I>/etc/cron.deny</I>
is not considered and your user must be listed in
<I>/etc/cron.allow</I>
in order to be able to use the crontab.
<P>
Regardless of the existence of any of these files, the root administrative
user is always allowed to setup a crontab. For standard Debian systems, all
users may use this command.
<P>
If the
<I>-u</I>
option is given, it specifies the name of the user whose crontab is to be
used (when listing) or modified (when editing). If this option is not given,
<I>crontab</I>
examines &quot;your&quot; crontab, i.e., the crontab of the person executing the
command. Note that
<I><A HREF="/cgi-bin/man/man2html?8+su">su</A></I>(8)
can confuse
<I>crontab</I>
and that if you are running inside of
<I><A HREF="/cgi-bin/man/man2html?8+su">su</A></I>(8)
you should always use the
<I>-u</I>
option for safety's sake.
<P>
The first form of this command is used to install a new crontab from some
named file or standard input if the pseudo-filename ``-'' is given.
<P>
The
<I>-l</I>
option causes the current crontab to be displayed on standard output. See
the note under
<B>DEBIAN SPECIFIC</B>
below.
<P>
The
<I>-r</I>
option causes the current crontab to be removed.
<P>
The
<I>-e</I>
option is used to edit the current crontab using the editor specified by
the <FONT SIZE="-1">VISUAL</FONT> or <FONT SIZE="-1">EDITOR</FONT> environment variables.
After you exit
from the editor, the modified crontab will be installed automatically. If
neither of the environment variables is defined, then the
default editor /usr/bin/editor is used.
<P>
The
<I>-i</I>
option modifies the -r option to prompt the user for a 'y/Y' response
before actually removing the crontab.
<A NAME="lbAE">&nbsp;</A>
<H2>DEBIAN SPECIFIC</H2>
The &quot;out-of-the-box&quot; behaviour for
<I>crontab -l</I>
is to display the three line &quot;DO NOT EDIT THIS FILE&quot; header
that is placed at the
beginning of the crontab when it is installed. The problem is that
it makes the sequence
<P>
crontab -l | crontab -
<P>
non-idempotent --- you keep adding copies of the header. This causes
pain to scripts that use sed to edit a crontab. Therefore, the default
behaviour of the
<B>-l</B>
option has been changed to not output such header. You may obtain the
original behaviour by setting the environment variable
<B>CRONTAB_NOHEADER</B>
to 'N', which will cause the
<I>crontab -l</I>
command to emit the extraneous header.
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
<A HREF="/cgi-bin/man/man2html?5+crontab">crontab</A>(5), <A HREF="/cgi-bin/man/man2html?8+cron">cron</A>(8)
<A NAME="lbAG">&nbsp;</A>
<H2>FILES</H2>
<PRE>
/etc/cron.allow
/etc/cron.deny
/var/spool/cron/crontabs
</PRE>
<P>
The files
<I>/etc/cron.allow</I>
and
<I>/etc/cron.deny</I>
if, they exist, must be either world-readable, or readable by group
``crontab''. If they are not, then cron will deny access to all users until the
permissions are fixed.
<P>
There is one file for each user's crontab under the /var/spool/cron/crontabs
directory. Users are not allowed to edit the files under that directory
directly to ensure that only users allowed by the system to run periodic tasks
can add them, and only syntactically correct crontabs will be written there.
This is enforced by having the directory writable only by the
<I>crontab</I>
group and configuring
<I>crontab</I>
command with the setgid bid set for that specific group.
<A NAME="lbAH">&nbsp;</A>
<H2>STANDARDS</H2>
The
<I>crontab</I>
command conforms to IEEE Std1003.2-1992 (``POSIX''). This new command syntax
differs from previous versions of Vixie Cron, as well as from the classic
SVR3 syntax.
<P>
<A NAME="lbAI">&nbsp;</A>
<H2>DIAGNOSTICS</H2>
A fairly informative usage message appears if you run it with a bad command
line.
<P>
cron requires that each entry in a crontab end in a newline character. If the
last entry in a crontab is missing the newline, cron will consider the crontab
(at least partially) broken and refuse to install it.
<P>
The files under
<I>/var/spool/cron/crontabs</I>
are named based on the user's account name.
Crontab jobs will not be run for users whose accounts have been
renamed either due to changes in the local system or because they are
managed through a central user database (external to the system, for
example an LDAP directory).
<P>
<P>
<A NAME="lbAJ">&nbsp;</A>
<H2>AUTHOR</H2>
Paul Vixie &lt;<A HREF="mailto:paul@vix.com">paul@vix.com</A>&gt; is the author of
<I>cron</I>
and original creator of this manual page. This page has also been modified for
Debian by Steve Greenland, Javier Fernandez-Sanguino and Christian Kastner.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="4"><A HREF="#lbAE">DEBIAN SPECIFIC</A><DD>
<DT id="5"><A HREF="#lbAF">SEE ALSO</A><DD>
<DT id="6"><A HREF="#lbAG">FILES</A><DD>
<DT id="7"><A HREF="#lbAH">STANDARDS</A><DD>
<DT id="8"><A HREF="#lbAI">DIAGNOSTICS</A><DD>
<DT id="9"><A HREF="#lbAJ">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:09 GMT, March 31, 2021
</BODY>
</HTML>