xref: /openbsd-src/usr.sbin/cron/cron.8 (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1.\"/* Copyright 1988,1990,1993,1996 by Paul Vixie
2.\" * All rights reserved
3.\" */
4.\"
5.\" Copyright (c) 1997,2000 by Internet Software Consortium, Inc.
6.\"
7.\" Permission to use, copy, modify, and distribute this software for any
8.\" purpose with or without fee is hereby granted, provided that the above
9.\" copyright notice and this permission notice appear in all copies.
10.\"
11.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
12.\" ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
13.\" OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
14.\" CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15.\" DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
16.\" PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
17.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
18.\" SOFTWARE.
19.\"
20.\" $OpenBSD: cron.8,v 1.11 2001/08/02 18:37:34 mpech Exp $
21.\"
22.Dd June 6, 1999
23.Dt CRON 8
24.Os
25.Sh NAME
26.Nm cron
27.Nd daemon to execute scheduled commands (Vixie Cron)
28.Sh SYNOPSIS
29.Nm cron
30.Sh DESCRIPTION
31.Nm
32should be started from
33.Pa /etc/rc
34or
35.Pa /etc/rc.local .
36It will return immediately, so you don't need to start it with
37.Ql \&& .
38.Pp
39.Nm
40searches its spool directory
41.Pf ( Pa /var/cron/tabs Ns )
42for
43.Xr crontab 5
44files which are named after accounts in
45.Pa /etc/passwd ;
46crontabs found are loaded into memory.
47.Nm
48also searches for
49.Pa /etc/crontab
50which is in a different format (see
51.Xr crontab 5 ) .
52.Nm
53then wakes up every minute, examining all loaded crontabs, checking each
54command to see if it should be run in the current minute.
55When executing commands, any output is mailed to the user named in the
56.Ev MAILTO
57environment variable in the crontab, or to the owner of the crontab if
58.Ev MAILTO
59is not present.
60.Pp
61Additionally,
62.Nm
63checks each minute to see if its spool directory's modtime (or the modtime on
64.Pa /etc/crontab )
65has changed, and if it has,
66.Nm
67examines the modtime on all crontabs and reloads those which have
68changed.
69Thus
70.Nm
71need not be restarted whenever a crontab file is modified.
72Note that the
73.Xr crontab 1
74command updates the modtime of the spool directory whenever it changes a
75crontab.
76.Pp
77Special considerations exist when the clock is changed by less than 3
78hours; for example, at the beginning and end of Daylight Saving
79Time.
80If the time has moved forward, those jobs which would have
81run in the time that was skipped will be run soon after the change.
82Conversely, if the time has moved backward by less than 3 hours,
83those jobs that fall into the repeated time will not be run.
84.Pp
85Only jobs that run at a particular time (not specified as @hourly, nor with
86.Ql *
87in the hour or minute specifier)
88are
89affected.
90Jobs which are specified with wildcards are run based on the
91new time immediately.
92.Pp
93Clock changes of more than 3 hours are considered to be corrections to
94the clock, and the new time is used immediately.
95.Sh SIGNALS
96On receipt of a
97.Tn SIGHUP ,
98the cron daemon will close and reopen its log file.
99This is useful in scripts which rotate and age log files.
100Naturally this is not relevant if cron was built to use
101.Xr syslog 3 .
102.Sh SEE ALSO
103.Xr crontab 1 ,
104.Xr crontab 5
105.Sh AUTHORS
106Paul Vixie <paul@vix.com>
107