File: cron.8

package info (click to toggle)
cron 3.0pl1-86
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 412 kB
  • ctags: 386
  • sloc: ansic: 3,652; sh: 194; makefile: 135
file content (124 lines) | stat: -rw-r--r-- 4,498 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
.\"/* Copyright 1988,1990,1993 by Paul Vixie
.\" * All rights reserved
.\" *
.\" * Distribute freely, except: don't remove my name from the source or
.\" * documentation (don't take credit for my work), mark your changes (don't
.\" * get me blamed for your possible bugs), don't alter or remove this
.\" * notice.  May be sold if buildable source is provided to buyer.  No
.\" * warrantee of any kind, express or implied, is included with this
.\" * software; use at your own risk, responsibility for damages (if any) to
.\" * anyone resulting from the use of this software rests entirely with the
.\" * user.
.\" *
.\" * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
.\" * I'll try to keep a version up to date.  I can be reached as follows:
.\" * Paul Vixie          <paul@vix.com>          uunet!decwrl!vixie!paul
.\" */
.\" 
.\" $Id: cron.8,v 2.2 1993/12/28 08:34:43 vixie Exp $
.\" 
.TH CRON 8 "20 December 1993"
.UC 4
.SH NAME
cron \- daemon to execute scheduled commands (Vixie Cron)
.SH SYNOPSIS
cron
.RB [ -f ]
.SH DESCRIPTION
.I cron
is started automatically from /etc/init.d on entering multi-user
runlevels.
.SH OPTIONS
.TP 8
.B -f
Stay in foreground mode, don't daemonize.
.TP
.B -l
Enable LSB compliant names for /etc/cron.d files
.SH NOTES
.PP
.I cron
searches its spool area (/var/spool/cron/crontabs) for crontab
files (which are named after accounts in
/etc/passwd); crontabs found are loaded into memory.  Note that
crontabs in this directory should not be accessed directly -
the
.I crontab
command should be used to access and update them.

.I cron
also reads /etc/crontab, which is in a slightly different format (see
.IR crontab(5) ). 
Additionally,
.I cron
reads the files in /etc/cron.d: it
treats the files in /etc/cron.d as extensions to the /etc/crontab file (they
follow the special format of that file, i.e. they include the 
.I user
field). The intended purpose of this feature is to allow packages that require
finer control of their scheduling than the /etc/cron.{daily,weekly,monthly} 
directories allow to add a crontab file to /etc/cron.d. Such files
should be named after the package that supplies them. Files must
conform to the same naming convention as used by 
.IR run-parts(8) :
they
must consist solely of upper- and lower-case letters, digits, underscores,
and hyphens. If the 
.B -l
option is specified, then they must conform to the LSB namespace specification,
exactly as in the
.B --lsbsysinit
option in 
.IR run-parts .

Like /etc/crontab, the files in the /etc/cron.d directory are
monitored for changes. In general, the admin should not use /etc/cron.d/,
but use the standard system crontab /etc/crontab.

.I cron
then wakes up every minute, examining all stored crontabs, checking
each command to see if it should be run in the current minute.  When
executing commands, any output is mailed to the owner of the crontab
(or to the user named in the MAILTO environment variable in the
crontab, if such exists).  The children copies of cron running these
processes have their name coerced to uppercase, as will be seen in the
syslog and ps output.
.PP
Additionally,
.I cron
checks each minute to see if its spool directory's modtime (or the modtime
on
.IR /etc/crontab)
has changed, and if it has,
.I cron
will then examine the modtime on all crontabs and reload those which have
changed.  Thus
.I cron
need not be restarted whenever a crontab file is modified.  Note that the
.IR crontab (1)
command updates the modtime of the spool directory whenever it changes a
crontab.
.PP
Special considerations exist when the clock is changed by less than 3
hours, for example at the beginning and end of daylight savings
time. If the time has moved forwards, those jobs which would have
run in the time that was skipped will be run soon after the change. 
Conversely, if the time has moved backwards by less than 3 hours,
those jobs that fall into the repeated time will not be re-run.
.PP
Only jobs that run at a particular time (not specified as
@hourly, nor with '*' in the hour or minute specifier) are
affected. Jobs which are specified with wildcards are run based on the
new time immediately.
.PP
Clock changes of more than 3 hours are considered to be corrections to
the clock, and the new time is used immediately.
.PP
.I cron
logs its action to the syslog facility 'cron', and logging may be
controlled using the standard syslogd(8) facility.
.SH "SEE ALSO"
crontab(1), crontab(5)
.SH AUTHOR
.nf
Paul Vixie <paul@vix.com>