1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
.\"
.\" Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $OpenBSD: cron.8,v 1.17 2003/02/01 16:29:52 jmc Exp $
.\"
.Dd July 6, 2002
.Dt CRON 8
.Os
.Sh NAME
.Nm cron
.Nd clock daemon
.Sh SYNOPSIS
.Nm cron
.Op Fl l Ar load_avg
.Op Fl x Ar [ext,sch,proc,pars,load,misc,test,bit]
.Sh DESCRIPTION
The
.Nm
daemon schedules commands to be run at specified dates and times.
Commands that are to be run periodically are specified within
.Xr crontab 5
files.
Commands that are only to be run once are scheduled via the
.Xr at 1
and
.Xr batch 1
commands.
Normally, the
.Nm
daemon is started from the
.Pa /etc/rc
command script.
Because it can execute commands on a user's behalf,
.Nm
should be run late in the startup sequence,
as close to the time when logins are accepted as possible.
.Pp
.Nm
loads
.Xr crontab 5
and
.Xr at 1
files when it starts up and also when changes are made via the
.Xr crontab 1
and
.Xr at 1
commands.
Additionally,
.Nm
checks the modification time on the system crontab file
.Pq Pa /etc/crontab ,
the crontab spool
.Pq Pa /var/cron/tabs ,
and the at spool
.Pq Pa /var/at/jobs
once a minute.
If the modification time has changed, the affected files are reloaded.
.Pp
Any output produced by a command is sent to the user specified in the
.Ev MAILTO
environment variable as set in the
.Xr crontab 5
file or, if no
.Ev MAILTO
variable is set (or if this is an
.Xr at 1
or
.Xr batch 1
job), to the job's owner.
If a command produces no output, no mail will be sent.
The exception to this is
.Xr at 1
or
.Xr batch 1
jobs submitted with the
.Fl m
flag.
In this case, mail will be sent even if the job produces no output.
.Ss Daylight Saving Time and other time changes
Local time changes of less than three hours, such as those caused
by the start or end of Daylight Saving Time, are handled specially.
This only applies to jobs that run at a specific time and jobs that
are run with a granularity greater than one hour. Jobs that run
more frequently are scheduled normally.
.Pp
If time has moved forward, those jobs that would have run in the
interval that has been skipped will be run immediately.
Conversely, if time has moved backward, care is taken to avoid running
jobs twice.
.Pp
Time changes of more than 3 hours are considered to be corrections to
the clock or timezone, and the new time is used immediately.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl l Ar load_avg
If the current load average is greater than
.Ar load_avg ,
.Xr batch 1
jobs will not be run.
The default value is 1.5.
To allow
.Xr batch 1
jobs to run regardless of the load, a value of 0.0 may be used.
.It Fl x Ar debug_flags
If
.Nm
was compiled with debugging support, a number of debugging flags
are available to show what
.Nm
is doing.
The following flags may be specified:
.Bl -tag -width Ds
.It ext
show extended information; used in conjunction with other debug flags
to provide even more information
.It sch
print information related to scheduling jobs
.It proc
print information related to running processes
.It pars
print information related to parsing
.Xr crontab 5
files
.It load
print when loading the databases
.It misc
show misc other debugging information
.It test
test mode; don't actually execute commands
.El
.Pp
Multiple flags may be specified, separated by a comma
.Pq So , Sc .
Regardless of which flags were specified, the
.Fl x
flag will cause
.Nm
to stay in the foreground and not become a daemon.
.El
.Sh SIGNALS
.Bl -tag -width Ds
.It Dv SIGHUP
causes
.Nm
to close and reopen its log file.
This is useful in scripts which rotate and age log files.
On
.Ox
this has no effect because
.Nm cron
logs via
.Xr syslog 3 .
.El
.Sh FILES
.Bl -tag -width "/var/cron/tabs/.sock" -compact
.It Pa /etc/crontab
system crontab file
.It Pa /var/at/jobs
directory containing
.Xr at 1
jobs
.It Pa /var/cron/log
cron's log file
.It Pa /var/cron/tabs
directory containing individual crontab files
.It Pa /var/cron/tabs/.sock
used by
.Xr crontab 1
to tell
.Nm
to check for crontab changes immediately
.El
.Sh SEE ALSO
.Xr at 1 ,
.Xr crontab 1 ,
.Xr syslog 3 ,
.Xr crontab 5
.Sh AUTHORS
Paul Vixie <vixie@isc.org>
|