]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - usr.sbin/cron/cron/cron.8
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / usr.sbin / cron / cron / cron.8
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 .\" $FreeBSD$
19 .\"
20 .Dd June 29, 2008
21 .Dt CRON 8
22 .Os
23 .Sh NAME
24 .Nm cron
25 .Nd daemon to execute scheduled commands (Vixie Cron)
26 .Sh SYNOPSIS
27 .Nm
28 .Op Fl j Ar jitter
29 .Op Fl J Ar rootjitter
30 .Op Fl m Ar mailto
31 .Op Fl s
32 .Op Fl o
33 .Op Fl x Ar debugflag Ns Op , Ns Ar ...
34 .Sh DESCRIPTION
35 The
36 .Nm
37 utility should be started from
38 .Pa /etc/rc
39 or
40 .Pa /etc/rc.local .
41 It will return immediately,
42 so you do not need to start it with '&'.
43 .Pp
44 The
45 .Nm
46 utility searches
47 .Pa /var/cron/tabs
48 for crontab files which are named after accounts in
49 .Pa /etc/passwd ;
50 crontabs found are loaded into memory.
51 The
52 .Nm
53 utility also searches for
54 .Pa /etc/crontab
55 which is in a different format (see
56 .Xr crontab 5 ) .
57 .Pp
58 The
59 .Nm
60 utility
61 then wakes up every minute, examining all stored crontabs, checking each
62 command to see if it should be run in the current minute.
63 Before running a command from a per-account crontab file,
64 .Nm
65 checks the status of the account with
66 .Xr pam 3
67 and skips the command if the account is unavailable,
68 e.g., locked out or expired.
69 Commands from
70 .Pa /etc/crontab
71 bypass this check.
72 When executing
73 commands, any output is mailed to the owner of the crontab (or to the user
74 named in the
75 .Ev MAILTO
76 environment variable in the crontab, if such exists).
77 .Pp
78 Additionally,
79 .Nm
80 checks each minute to see if its spool directory's modification time (or
81 the modification time on
82 .Pa /etc/crontab )
83 has changed, and if it has,
84 .Nm
85 will then examine the modification time on all crontabs and reload those
86 which have changed.
87 Thus
88 .Nm
89 need not be restarted whenever a crontab file is modified.
90 Note that the
91 .Xr crontab 1
92 command updates the modification time of the spool directory whenever it
93 changes a crontab.
94 .Pp
95 Available options:
96 .Bl -tag -width indent
97 .It Fl j Ar jitter
98 Enable time jitter.
99 Prior to executing commands,
100 .Nm
101 will sleep a random number of seconds in the range from 0 to
102 .Ar jitter .
103 This will not affect superuser jobs (see
104 .Fl J ) .
105 A value for
106 .Ar jitter
107 must be between 0 and 60 inclusive.
108 Default is 0, which effectively disables time jitter.
109 .Pp
110 This option can help to smooth down system load spikes during
111 moments when a lot of jobs are likely to start at once, e.g.,
112 at the beginning of the first minute of each hour.
113 .It Fl J Ar rootjitter
114 Enable time jitter for superuser jobs.
115 The same as
116 .Fl j
117 except that it will affect jobs run by the superuser only.
118 .It Fl m Ar mailto
119 Overrides the default recipient for
120 .Nm
121 mail.
122 Each
123 .Xr crontab 5
124 without
125 .Ev MAILTO
126 explicitly set will send mail to the
127 .Ar mailto
128 mailbox.
129 Sending mail will be disabled by default if
130 .Ar mailto
131 set to a null string, usually specified in a shell as
132 .Li ''
133 or
134 .Li \*q\*q .
135 .It Fl s
136 Enable special handling of situations when the GMT offset of the local
137 timezone changes, such as the switches between the standard time and
138 daylight saving time.
139 .Pp
140 The jobs run during the GMT offset changes time as
141 intuitively expected.
142 If a job falls into a time interval that disappears
143 (for example, during the switch from
144 standard time) to daylight saving time or is
145 duplicated (for example, during the reverse switch), then it is handled
146 in one of two ways:
147 .Pp
148 The first case is for the jobs that run every at hour of a time interval
149 overlapping with the disappearing or duplicated interval.
150 In other words, if the job had run within one hour before the GMT offset change
151 (and cron was not restarted nor the
152 .Xr crontab 5
153 changed after that)
154 or would run after the change at the next hour.
155 They work as always, skip the skipped time or run in the added
156 time as usual.
157 .Pp
158 The second case is for the jobs that run less frequently.
159 They are executed exactly once, they are not skipped nor
160 executed twice (unless cron is restarted or the user's
161 .Xr crontab 5
162 is changed during such a time interval).
163 If an interval disappears
164 due to the GMT offset change, such jobs are
165 executed at the same absolute point of time as they would be in the
166 old time zone.
167 For example, if exactly one hour disappears, this
168 point would be during the next hour at the first minute that is
169 specified for them in
170 .Xr crontab 5 .
171 .It Fl o
172 Disable the special handling of situations when the GMT offset of the local
173 timezone changes, to be compatible with the old (default) behavior.
174 If both options
175 .Fl o
176 and
177 .Fl s
178 are specified, the option specified last wins.
179 .It Fl x Ar debugflag Ns Op , Ns Ar ...
180 Enable writing of debugging information to standard output.
181 One or more of the following comma separated
182 .Ar debugflag
183 identifiers must be specified:
184 .Pp
185 .Bl -tag -width ".Cm proc" -compact
186 .It Cm bit
187 currently not used
188 .It Cm ext
189 make the other debug flags more verbose
190 .It Cm load
191 be verbose when loading crontab files
192 .It Cm misc
193 be verbose about miscellaneous one-off events
194 .It Cm pars
195 be verbose about parsing individual crontab lines
196 .It Cm proc
197 be verbose about the state of the process, including all of its offspring
198 .It Cm sch
199 be verbose when iterating through the scheduling algorithms
200 .It Cm test
201 trace through the execution, but do not perform any actions
202 .El
203 .El
204 .Sh FILES
205 .Bl -tag -width /etc/pam.d/cron -compact
206 .It Pa /etc/crontab
207 System crontab file
208 .It Pa /etc/pam.d/cron
209 .Xr pam.conf 5
210 configuration file for
211 .Nm
212 .It Pa /var/cron/tabs
213 Directory for personal crontab files
214 .El
215 .Sh SEE ALSO
216 .Xr crontab 1 ,
217 .Xr pam 3 ,
218 .Xr crontab 5 ,
219 .Xr pam.conf 5
220 .Sh AUTHORS
221 .An Paul Vixie Aq paul@vix.com