| 1 |
.\"/* Copyright 1988,1990,1993 by Paul Vixie
|
| 2 |
.\" * All rights reserved
|
| 3 |
.\" *
|
| 4 |
.\" * Distribute freely, except: don't remove my name from the source or
|
| 5 |
.\" * documentation (don't take credit for my work), mark your changes (don't
|
| 6 |
.\" * get me blamed for your possible bugs), don't alter or remove this
|
| 7 |
.\" * notice. May be sold if buildable source is provided to buyer. No
|
| 8 |
.\" * warrantee of any kind, express or implied, is included with this
|
| 9 |
.\" * software; use at your own risk, responsibility for damages (if any) to
|
| 10 |
.\" * anyone resulting from the use of this software rests entirely with the
|
| 11 |
.\" * user.
|
| 12 |
.\" *
|
| 13 |
.\" * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
|
| 14 |
.\" * I'll try to keep a version up to date. I can be reached as follows:
|
| 15 |
.\" * Paul Vixie <paul@vix.com> uunet!decwrl!vixie!paul
|
| 16 |
.\" */
|
| 17 |
.\"
|
| 18 |
.\" $Id: cron.8,v 2.2 1993/12/28 08:34:43 vixie Exp $
|
| 19 |
.\"
|
| 20 |
.TH CRON 8 "19 April 2010"
|
| 21 |
.UC 4
|
| 22 |
.SH NAME
|
| 23 |
cron \- daemon to execute scheduled commands (Vixie Cron)
|
| 24 |
.SH SYNOPSIS
|
| 25 |
cron
|
| 26 |
.RB [ -f ]
|
| 27 |
.RB [ -l ]
|
| 28 |
.RB [ -L
|
| 29 |
.IR loglevel ]
|
| 30 |
.SH DESCRIPTION
|
| 31 |
.I cron
|
| 32 |
is started automatically from /etc/init.d on entering multi-user
|
| 33 |
runlevels.
|
| 34 |
.SH OPTIONS
|
| 35 |
.TP 8
|
| 36 |
.B -f
|
| 37 |
Stay in foreground mode, don't daemonize.
|
| 38 |
.TP
|
| 39 |
.B -l
|
| 40 |
Enable LSB compliant names for /etc/cron.d files
|
| 41 |
.TP
|
| 42 |
.B -L loglevel
|
| 43 |
Sets the loglevel for cron. The standard logging level (1) will log
|
| 44 |
the start of all the cron jobs. A higher loglevel (2) will cause
|
| 45 |
cron to log also the end of all cronjobs, which can be useful to
|
| 46 |
audit the behaviour of tasks run by cron. Logging will be disabled
|
| 47 |
if the \fIloglevel\fR is set to zero (0).
|
| 48 |
.SH NOTES
|
| 49 |
.PP
|
| 50 |
.I cron
|
| 51 |
searches its spool area (/var/spool/cron/crontabs) for crontab
|
| 52 |
files (which are named after accounts in
|
| 53 |
/etc/passwd); crontabs found are loaded into memory. Note that
|
| 54 |
crontabs in this directory should not be accessed directly -
|
| 55 |
the
|
| 56 |
.I crontab
|
| 57 |
command should be used to access and update them.
|
| 58 |
|
| 59 |
.I cron
|
| 60 |
also reads /etc/crontab, which is in a slightly different format (see
|
| 61 |
.IR crontab(5) ).
|
| 62 |
Additionally,
|
| 63 |
.I cron
|
| 64 |
reads the files in /etc/cron.d: it
|
| 65 |
treats the files in /etc/cron.d as in the same way as the /etc/crontab file (they
|
| 66 |
follow the special format of that file, i.e. they include the
|
| 67 |
.I user
|
| 68 |
field). However, they are independent of /etc/crontab: they do not, for
|
| 69 |
example, inherit environment variable settings from it. The intended purpose
|
| 70 |
of this feature is to allow packages that require
|
| 71 |
finer control of their scheduling than the /etc/cron.{daily,weekly,monthly}
|
| 72 |
directories to add a crontab file to /etc/cron.d. Such files
|
| 73 |
should be named after the package that supplies them. Files must
|
| 74 |
conform to the same naming convention as used by
|
| 75 |
.IR run-parts(8) :
|
| 76 |
they
|
| 77 |
must consist solely of upper- and lower-case letters, digits, underscores,
|
| 78 |
and hyphens. If the
|
| 79 |
.B -l
|
| 80 |
option is specified, then they must conform to the LSB namespace specification,
|
| 81 |
exactly as in the
|
| 82 |
.B --lsbsysinit
|
| 83 |
option in
|
| 84 |
.IR run-parts .
|
| 85 |
|
| 86 |
Like /etc/crontab, the files in the /etc/cron.d directory are
|
| 87 |
monitored for changes. In general, the admin should not use /etc/cron.d/,
|
| 88 |
but use the standard system crontab /etc/crontab.
|
| 89 |
|
| 90 |
In contrast to the spool area, files in /etc/cron.d may be symlinks, provided
|
| 91 |
that both the symlink and the file it points to are owned by root.
|
| 92 |
|
| 93 |
.I cron
|
| 94 |
then wakes up every minute, examining all stored crontabs, checking
|
| 95 |
each command to see if it should be run in the current minute. When
|
| 96 |
executing commands, any output is mailed to the owner of the crontab
|
| 97 |
(or to the user named in the MAILTO environment variable in the
|
| 98 |
crontab, if such exists). The children copies of cron running these
|
| 99 |
processes have their name coerced to uppercase, as will be seen in the
|
| 100 |
syslog and ps output.
|
| 101 |
.PP
|
| 102 |
Additionally,
|
| 103 |
.I cron
|
| 104 |
checks each minute to see if its spool directory's modtime (or the modtime
|
| 105 |
on
|
| 106 |
.IR /etc/crontab)
|
| 107 |
has changed, and if it has,
|
| 108 |
.I cron
|
| 109 |
will then examine the modtime on all crontabs and reload those which have
|
| 110 |
changed. Thus
|
| 111 |
.I cron
|
| 112 |
need not be restarted whenever a crontab file is modified. Note that the
|
| 113 |
.IR crontab (1)
|
| 114 |
command updates the modtime of the spool directory whenever it changes a
|
| 115 |
crontab.
|
| 116 |
.PP
|
| 117 |
Special considerations exist when the clock is changed by less than 3
|
| 118 |
hours, for example at the beginning and end of daylight savings
|
| 119 |
time. If the time has moved forwards, those jobs which would have
|
| 120 |
run in the time that was skipped will be run soon after the change.
|
| 121 |
Conversely, if the time has moved backwards by less than 3 hours,
|
| 122 |
those jobs that fall into the repeated time will not be re-run.
|
| 123 |
.PP
|
| 124 |
Only jobs that run at a particular time (not specified as
|
| 125 |
@hourly, nor with '*' in the hour or minute specifier) are
|
| 126 |
affected. Jobs which are specified with wildcards are run based on the
|
| 127 |
new time immediately.
|
| 128 |
.PP
|
| 129 |
Clock changes of more than 3 hours are considered to be corrections to
|
| 130 |
the clock, and the new time is used immediately.
|
| 131 |
.PP
|
| 132 |
.I cron
|
| 133 |
logs its action to the syslog facility 'cron', and logging may be
|
| 134 |
controlled using the standard syslogd(8) facility.
|
| 135 |
.SH ENVIRONMENT
|
| 136 |
If configured in
|
| 137 |
.I /etc/default/cron
|
| 138 |
in Debian systems, the
|
| 139 |
.I cron
|
| 140 |
daemon localisation settings environment can be managed through the use of
|
| 141 |
.I /etc/environment
|
| 142 |
or through the use of
|
| 143 |
.I /etc/default/locale
|
| 144 |
whichever is available (with the latter one taking precedence). These
|
| 145 |
files are read and they will use to setup the LANG, LC_ALL, and
|
| 146 |
LC_CTYPE environment variables.
|
| 147 |
.PP
|
| 148 |
The daemon will use, if present, the definition from
|
| 149 |
.I /etc/timezone
|
| 150 |
for the timezone.
|
| 151 |
.PP
|
| 152 |
The environment can be redefined in user's crontab definitions but
|
| 153 |
.I cron
|
| 154 |
will only handle tasks in a single timezone.
|
| 155 |
.SH "SEE ALSO"
|
| 156 |
crontab(1), crontab(5)
|
| 157 |
.SH AUTHOR
|
| 158 |
.nf
|
| 159 |
Paul Vixie <paul@vix.com>
|