xref: /netbsd/external/bsd/cron/dist/cron.8 (revision 6550d01e)
1.\"	$NetBSD: cron.8,v 1.3 2010/05/08 11:55:01 wiz Exp $
2.\"
3.\" Id: cron.8,v 1.8 2004/01/23 19:03:32 vixie Exp
4.\"
5.Dd May 5, 2010
6.Dt CRON 8
7.Os
8.Sh NAME
9.Nm cron
10.Nd daemon to execute scheduled commands (ISC Cron V4.1)
11.Sh SYNOPSIS
12.Nm
13.Op Fl n
14.Op Fl x Ar debugflags
15.Sh DESCRIPTION
16.Nm
17is normally started during system boot by
18.Xr rc.d 8
19framework, if cron is switched on in
20.Xr rc.conf 5 .
21.Pp
22It will return immediately so you don't have to start it with
23.Sq \*[Am] .
24.Pp
25.Nm
26searches
27.Pa /var/cron/tabs
28for crontab files which are named after accounts in
29.Pa /etc/passwd .
30Crontabs found are loaded into memory.
31.Nm
32also searches for
33.Pa /etc/crontab
34which is in a different format (see
35.Xr crontab 5 ) .
36.Nm
37then wakes up every minute, examining all stored crontabs, checking each
38command to see if it should be run in the current minute.
39When executing commands, any output is mailed to the owner of the
40crontab (or to the user named in the
41.Ev MAILTO
42environment variable in the crontab, if such exists).
43.Pp
44Events such as
45.Dv START
46and
47.Dv FINISH
48are recorded in the
49.Pa /var/log/cron
50log file with date and time details.
51This information is useful for a number of reasons, such as
52determining the amount of time required to run a particular job.
53By default, root has an hourly job that rotates these log files
54with compression to preserve disk space.
55.Pp
56Additionally,
57.Nm
58checks each minute to see if its spool directory's modtime (or the modtime
59on
60.Pa /etc/crontab )
61has changed, and if it has,
62.Nm
63will then examine the modtime on all crontabs and reload those which have
64changed.
65Thus
66.Nm
67need not be restarted whenever a crontab file is modified.
68Note that the
69.Xr crontab 1
70command updates the modtime of the spool directory whenever it changes a
71crontab.
72.Pp
73The following options are available:
74.Bl -tag -width indent
75.It Fl x
76This  flag turns on some debugging flags.
77.Ar debugflags
78is comma-separated list of debugging flags to turn on.
79If a flag is turned on,
80.Nm
81writes some additional debugging information to system log during
82its work.
83Available debugging flags are:
84.Bl -tag -width proc -compact
85.It Ar sch
86scheduling
87.It Ar proc
88process control
89.It Ar pars
90parsing
91.It Ar load
92database loading
93.It Ar misc
94miscellaneous
95.It Ar test
96test mode - do not actually execute any commands
97.It Ar bit
98show how various bits are set (long)
99.It Ar ext
100print extended debugging information
101.El
102.It Fl n
103Stay in the foreground and don't daemonize
104.Nm .
105.El
106.Sh Daylight Saving Time and other time changes
107Local time changes of less than three hours, such as those caused
108by the start or end of Daylight Saving Time, are handled specially.
109This only applies to jobs that run at a specific time and jobs that
110are run with a granularity greater than one hour.
111Jobs that run more frequently are scheduled normally.
112.Pp
113If time has moved forward, those jobs that would have run in the
114interval that has been skipped will be run immediately.
115Conversely, if time has moved backward, care is taken to avoid running
116jobs twice.
117.Pp
118Time changes of more than 3 hours are considered to be corrections to
119the clock or timezone, and the new time is used immediately.
120.Sh SIGNALS
121On receipt of a
122.Dv SIGHUP ,
123the cron daemon will close and reopen its
124log file.
125This is useful in scripts which rotate and age log files.
126Naturally this is not relevant if cron was built to use
127.Xr syslog 3 .
128.Sh FILES
129.Bl -tag -width /var/cron/tabs -compact
130.It Pa /var/cron/tabs
131.Nm
132spool directory
133.It Pa /etc/crontab
134system crontab
135.It Pa /var/log/cron
136log file for cron events
137.El
138.Sh SEE ALSO
139.Xr crontab 1 ,
140.Xr crontab 5
141.Sh AUTHORS
142.An Paul Vixie
143.Aq vixie@isc.org
144