File: crontab.5.html

package info (click to toggle)
bcron 0.11-24
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 796 kB
  • sloc: sh: 3,155; ansic: 2,416; makefile: 34
file content (354 lines) | stat: -rw-r--r-- 10,776 bytes parent folder | download | duplicates (5)
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<!-- Creator     : groff version 1.22.2 -->
<!-- CreationDate: Wed Aug 12 10:07:16 2015 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
       p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
       pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
       table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
       h1      { text-align: center }
</style>
<title>CRONTAB</title>

</head>
<body>

<h1 align="center">CRONTAB</h1>

<a href="#NAME">NAME</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#EXAMPLE CRON FILE">EXAMPLE CRON FILE</a><br>
<a href="#FILES">FILES</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<a href="#EXTENSIONS">EXTENSIONS</a><br>
<a href="#AUTHOR">AUTHOR</a><br>

<hr>


<h2>NAME
<a name="NAME"></a>
</h2>


<p style="margin-left:11%; margin-top: 1em">crontab &minus;
tables for driving bcron</p>

<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>


<p style="margin-left:11%; margin-top: 1em">A
<i>crontab</i> file contains instructions to the
<i>bcron&minus;sched</i>(8) daemon of the general form:
&lsquo;&lsquo;run this command at this time on this
date&rsquo;&rsquo;. Each user has their own crontab, and
commands in any given crontab will be executed as the user
who owns the crontab.</p>

<p style="margin-left:11%; margin-top: 1em">Blank lines and
leading spaces and tabs are ignored. Lines whose first
non-space character is a pound-sign (#) are comments, and
are ignored. Note that comments are not allowed on the same
line as cron commands, since they will be taken to be part
of the command. Similarly, comments are not allowed on the
same line as environment variable settings.</p>

<p style="margin-left:11%; margin-top: 1em">An active line
in a crontab will be either an environment setting or a cron
command. An environment setting is of the form,</p>

<p style="margin-left:11%; margin-top: 1em">name =
value</p>

<p style="margin-left:11%; margin-top: 1em">where the
spaces around the equal-sign (=) are optional, and any
subsequent non-leading spaces in <i>value</i> will be part
of the value assigned to <i>name</i>. The <i>value</i>
string may be placed in quotes (single or double, but
matching) to preserve leading or trailing blanks.</p>

<p style="margin-left:11%; margin-top: 1em">Several
environment variables are set up automatically by the
<i>bcron&minus;exec</i>(8) program. SHELL is set to /bin/sh,
and LOGNAME, USER, and HOME are set from the
<i>/etc/passwd</i> line of the crontab&rsquo;s owner.</p>

<p style="margin-left:11%; margin-top: 1em">In addition to
LOGNAME, USER, HOME, and SHELL, <i>bcron&minus;exec</i>(8)
will look at MAILTO if it has any reason to send mail as a
result of running commands in
&lsquo;&lsquo;this&rsquo;&rsquo; crontab. If MAILTO is
defined (and non-empty), mail is sent to the user so named.
If MAILTO is defined but empty (MAILTO=&quot;&quot;), no
mail will be sent. Otherwise mail is sent to the owner of
the crontab. This option is useful if you decide on
/bin/mail instead of /usr/lib/sendmail as your mailer when
you install cron -- /bin/mail doesn&rsquo;t do aliasing, and
UUCP usually doesn&rsquo;t read its mail.</p>

<p style="margin-left:11%; margin-top: 1em">The format of a
cron command is very much the V7 standard, with a number of
upward-compatible extensions. Each line has five time and
date fields, followed by a user name if this is the system
crontab file, followed by a command. Commands are executed
by <i>bcron&minus;sched</i>(8) when the minute, hour, and
month of year fields match the current time, <i>and</i> at
least one of the two day fields (day of month, or day of
week) match the current time (see
&lsquo;&lsquo;Note&rsquo;&rsquo; below). Jobs scheduled
during non-existent times, such as &quot;missing hours&quot;
during daylight savings conversion, will be scheduled at
some point shortly after the non-existent time. Jobs
scheduled during repeating times, such as &quot;duplicate
hours&quot; during daylight savings conversion, will be
scheduled only once (unless they would repeat anyways, such
as jobs that run every minute or hour).</p>

<p style="margin-left:11%; margin-top: 1em">The time and
date fields are:</p>

<table width="100%" border="0" rules="none" frame="void"
       cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="22%"></td>
<td width="1%">


<p>field</p></td>
<td width="77%">


<p>allowed values</p></td></tr>
<tr valign="top" align="left">
<td width="22%"></td>
<td width="1%">


<p>-----</p></td>
<td width="77%">


<p>--------------</p></td></tr>
<tr valign="top" align="left">
<td width="22%"></td>
<td width="1%">


<p>minute</p></td>
<td width="77%">


<p>0-59</p></td></tr>
<tr valign="top" align="left">
<td width="22%"></td>
<td width="1%">


<p>hour</p></td>
<td width="77%">


<p>0-23</p></td></tr>
<tr valign="top" align="left">
<td width="22%"></td>
<td width="1%">


<p>day of month</p></td>
<td width="77%">


<p>1-31</p></td></tr>
<tr valign="top" align="left">
<td width="22%"></td>
<td width="1%">


<p>month</p></td>
<td width="77%">


<p>1-12 (or names, see below)</p></td></tr>
<tr valign="top" align="left">
<td width="22%"></td>
<td width="1%">


<p>day of week</p></td>
<td width="77%">


<p>0-7 (0 or 7 is Sun, or use names)</p></td></tr>
</table>

<p style="margin-left:11%; margin-top: 1em">A field may be
an asterisk (*), which always stands for
&lsquo;&lsquo;first&minus;last&rsquo;&rsquo;.</p>

<p style="margin-left:11%; margin-top: 1em">Ranges of
numbers are allowed. Ranges are two numbers separated with a
hyphen. The specified range is inclusive. For example, 8-11
for an &lsquo;&lsquo;hours&rsquo;&rsquo; entry specifies
execution at hours 8, 9, 10 and 11.</p>

<p style="margin-left:11%; margin-top: 1em">Lists are
allowed. A list is a set of numbers (or ranges) separated by
commas. Examples: &lsquo;&lsquo;1,2,5,9&rsquo;&rsquo;,
&lsquo;&lsquo;0-4,8-12&rsquo;&rsquo;.</p>

<p style="margin-left:11%; margin-top: 1em">Step values can
be used in conjunction with ranges. Following a range with
&lsquo;&lsquo;/&lt;number&gt;&rsquo;&rsquo; specifies skips
of the number&rsquo;s value through the range. For example,
&lsquo;&lsquo;0-23/2&rsquo;&rsquo; can be used in the hours
field to specify command execution every other hour (the
alternative in the V7 standard is
&lsquo;&lsquo;0,2,4,6,8,10,12,14,16,18,20,22&rsquo;&rsquo;).
Steps are also permitted after an asterisk, so if you want
to say &lsquo;&lsquo;every two hours&rsquo;&rsquo;, just use
&lsquo;&lsquo;*/2&rsquo;&rsquo;.</p>

<p style="margin-left:11%; margin-top: 1em">Names can also
be used for the &lsquo;&lsquo;month&rsquo;&rsquo; and
&lsquo;&lsquo;day of week&rsquo;&rsquo; fields. Use the
first three letters of the particular day or month (case
doesn&rsquo;t matter). Ranges or lists of names are not
allowed.</p>

<p style="margin-left:11%; margin-top: 1em">The
&lsquo;&lsquo;sixth&rsquo;&rsquo; field (the rest of the
line) specifies the command to be run. The entire command
portion of the line will be executed by /bin/sh or by the
shell specified in the SHELL variable of the cronfile.</p>

<p style="margin-left:11%; margin-top: 1em">Note: The day
of a command&rsquo;s execution can be specified by two
fields &mdash; day of month, and day of week. If both fields
are restricted (ie, aren&rsquo;t *), the command will be run
when <i>either</i> field matches the current time. For
example, <br>
&lsquo;&lsquo;30 4 1,15 * 5&rsquo;&rsquo; would cause a
command to be run at 4:30 am on the 1st and 15th of each
month, plus every Friday.</p>

<h2>EXAMPLE CRON FILE
<a name="EXAMPLE CRON FILE"></a>
</h2>


<p style="margin-left:11%; margin-top: 1em"># use /bin/sh
to run commands, no matter what /etc/passwd says <br>
SHELL=/bin/sh <br>
# mail any output to &lsquo;bruce@example.com&rsquo;, no
matter whose crontab this is <br>
MAILTO=bruce@example.com <br>
# <br>
# run five minutes after midnight, every day <br>
5 0 * * * $HOME/bin/daily.job &gt;&gt; $HOME/tmp/out
2&gt;&amp;1 <br>
# run at 2:15pm on the first of every month -- output mailed
to bruce (above) <br>
15 14 1 * * $HOME/bin/monthly <br>
23 0-23/2 * * * echo &quot;run 23 minutes after midn, 2am,
4am ..., everyday&quot; <br>
5 4 * * sun echo &quot;run at 5 after 4 every
sunday&quot;</p>

<h2>FILES
<a name="FILES"></a>
</h2>


<table width="100%" border="0" rules="none" frame="void"
       cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="18%">


<p style="margin-top: 1em"><i>/etc/crontab</i></p></td>
<td width="13%"></td>
<td width="36%">


<p style="margin-top: 1em">System crontab file</p></td>
<td width="22%">
</td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="18%">


<p><i>/etc/cron.d/</i></p></td>
<td width="13%"></td>
<td width="36%">


<p>System crontab directory</p></td>
<td width="22%">
</td></tr>
</table>

<h2>SEE ALSO
<a name="SEE ALSO"></a>
</h2>



<p style="margin-left:11%; margin-top: 1em">bcron&minus;sched(8),
bcron&minus;spool(8), bcrontab(1)</p>

<h2>EXTENSIONS
<a name="EXTENSIONS"></a>
</h2>


<p style="margin-left:11%; margin-top: 1em">When specifying
day of week, both day 0 and day 7 will be considered Sunday.
BSD and ATT seem to disagree about this.</p>

<p style="margin-left:11%; margin-top: 1em">Lists and
ranges are allowed to co-exist in the same field.
&quot;1-3,7-9&quot; would be rejected by ATT or BSD cron --
they want to see &quot;1-3&quot; or &quot;7,8,9&quot;
ONLY.</p>

<p style="margin-left:11%; margin-top: 1em">Ranges can
include &quot;steps&quot;, so &quot;1-9/2&quot; is the same
as &quot;1,3,5,7,9&quot;.</p>

<p style="margin-left:11%; margin-top: 1em">Names of months
or days of the week can be specified by name.</p>

<p style="margin-left:11%; margin-top: 1em">Environment
variables can be set in the crontab. In BSD or ATT, the
environment handed to child processes is basically the one
from /etc/rc.</p>

<p style="margin-left:11%; margin-top: 1em">Command output
is mailed to the crontab owner (BSD can&rsquo;t do this),
can be mailed to a person other than the crontab owner (SysV
can&rsquo;t do this), or the feature can be turned off and
no mail will be sent at all (SysV can&rsquo;t do this
either).</p>

<h2>AUTHOR
<a name="AUTHOR"></a>
</h2>


<p style="margin-left:11%; margin-top: 1em">Paul Vixie
&lt;vixie@isc.org&gt; <br>
Charles Cazabon &lt;charlesc-cronman @
discworld.dyndns.org&gt; <br>
Bruce Guenter &lt;bruce@untroubled.org&gt;</p>
<hr>
</body>
</html>