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