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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
.\" $NetBSD: cron.8,v 1.5 2011/10/12 22:50:31 wiz Exp $
.\"
.\" Id: cron.8,v 1.8 2004/01/23 19:03:32 vixie Exp
.\"
.Dd October 12, 2011
.Dt CRON 8
.Os
.Sh NAME
.Nm cron
.Nd daemon to execute scheduled commands (ISC Cron V4.1)
.Sh SYNOPSIS
.Nm
.Op Fl n
.Op Fl x Ar debugflags
.Sh DESCRIPTION
.Nm
is normally started during system boot by
.Xr rc.d 8
framework, if cron is switched on in
.Xr rc.conf 5 .
.Pp
It will return immediately so you don't have to start it with
.Sq \*[Am] .
.Pp
.Nm
searches
.Pa /var/cron/tabs
for crontab files which are named after accounts in
.Pa /etc/passwd .
Crontabs found are loaded into memory.
.Nm
also searches for
.Pa /etc/crontab
which is in a different format (see
.Xr crontab 5 ) .
Finally
.Nm
looks for crontabs in
.Pa /etc/cron.d
if it exists, and executes each file as a crontab.
.Pp
When
.Nm
looks in a directory for crontabs (either in
.Pa /var/cron/tabs
or
.Pa /etc/cron.d )
it will not process files that:
.Bl -dash -compact -offset indent
.It
Start with a
.Sq \&.
or a
.Sq # .
.It
End with a
.Sq ~
or with
.Dq .rpmsave ,
.Dq .rpmorig ,
or
.Dq .rpmnew .
.It
Are of zero length.
.It
Their length is greater than
.Dv MAXNAMLEN .
.El
.Pp
.Nm
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
.Ev MAILTO
environment variable in the crontab, if such exists).
.Pp
Events such as
.Dv START
and
.Dv FINISH
are recorded in the
.Pa /var/log/cron
log file with date and time details.
This information is useful for a number of reasons, such as
determining the amount of time required to run a particular job.
By default, root has an hourly job that rotates these log files
with compression to preserve disk space.
.Pp
Additionally,
.Nm
checks each minute to see if its spool directory's modtime (or the modtime
on
.Pa /etc/crontab
or
.Pa /etc/cron.d )
has changed, and if it has,
.Nm
will then examine the modtime on all crontabs and reload those which have
changed.
Thus
.Nm
need not be restarted whenever a crontab file is modified.
Note that the
.Xr crontab 1
command updates the modtime of the spool directory whenever it changes a
crontab.
.Pp
The following options are available:
.Bl -tag -width indent
.It Fl x
This flag turns on some debugging flags.
.Ar debugflags
is comma-separated list of debugging flags to turn on.
If a flag is turned on,
.Nm
writes some additional debugging information to system log during
its work.
Available debugging flags are:
.Bl -tag -width proc -compact
.It Ar sch
scheduling
.It Ar proc
process control
.It Ar pars
parsing
.It Ar load
database loading
.It Ar misc
miscellaneous
.It Ar test
test mode - do not actually execute any commands
.It Ar bit
show how various bits are set (long)
.It Ar ext
print extended debugging information
.El
.It Fl n
Stay in the foreground and don't daemonize
.Nm .
.El
.Sh Daylight Saving Time and other time changes
Local time changes of less than three hours, such as those caused
by the start or end of Daylight Saving Time, are handled specially.
This only applies to jobs that run at a specific time and jobs that
are run with a granularity greater than one hour.
Jobs that run more frequently are scheduled normally.
.Pp
If time has moved forward, those jobs that would have run in the
interval that has been skipped will be run immediately.
Conversely, if time has moved backward, care is taken to avoid running
jobs twice.
.Pp
Time changes of more than 3 hours are considered to be corrections to
the clock or timezone, and the new time is used immediately.
.Sh SIGNALS
On receipt of a
.Dv SIGHUP ,
the cron daemon will close and reopen its
log file.
This is useful in scripts which rotate and age log files.
Naturally this is not relevant if cron was built to use
.Xr syslog 3 .
.Sh FILES
.Bl -tag -width /var/cron/tabs -compact
.It Pa /var/cron/tabs
.Nm
spool directory
.It Pa /etc/crontab
system crontab file
.It Pa /etc/cron.d/
system crontab directory
.It Pa /var/log/cron
log file for cron events
.El
.Sh SEE ALSO
.Xr crontab 1 ,
.Xr crontab 5
.Sh AUTHORS
.An Paul Vixie
.Aq vixie@isc.org
|