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