| 1 |
<!-- Creator : groff version 1.22.2 --> |
| 2 |
<!-- CreationDate: Wed Aug 12 10:07:16 2015 --> |
| 3 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| 4 |
"http://www.w3.org/TR/html4/loose.dtd"> |
| 5 |
<html> |
| 6 |
<head> |
| 7 |
<meta name="generator" content="groff -Thtml, see www.gnu.org"> |
| 8 |
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> |
| 9 |
<meta name="Content-Style" content="text/css"> |
| 10 |
<style type="text/css"> |
| 11 |
p { margin-top: 0; margin-bottom: 0; vertical-align: top } |
| 12 |
pre { margin-top: 0; margin-bottom: 0; vertical-align: top } |
| 13 |
table { margin-top: 0; margin-bottom: 0; vertical-align: top } |
| 14 |
h1 { text-align: center } |
| 15 |
</style> |
| 16 |
<title>CRONTAB</title> |
| 17 |
|
| 18 |
</head> |
| 19 |
<body> |
| 20 |
|
| 21 |
<h1 align="center">CRONTAB</h1> |
| 22 |
|
| 23 |
<a href="#NAME">NAME</a><br> |
| 24 |
<a href="#DESCRIPTION">DESCRIPTION</a><br> |
| 25 |
<a href="#EXAMPLE CRON FILE">EXAMPLE CRON FILE</a><br> |
| 26 |
<a href="#FILES">FILES</a><br> |
| 27 |
<a href="#SEE ALSO">SEE ALSO</a><br> |
| 28 |
<a href="#EXTENSIONS">EXTENSIONS</a><br> |
| 29 |
<a href="#AUTHOR">AUTHOR</a><br> |
| 30 |
|
| 31 |
<hr> |
| 32 |
|
| 33 |
|
| 34 |
<h2>NAME |
| 35 |
<a name="NAME"></a> |
| 36 |
</h2> |
| 37 |
|
| 38 |
|
| 39 |
<p style="margin-left:11%; margin-top: 1em">crontab − |
| 40 |
tables for driving bcron</p> |
| 41 |
|
| 42 |
<h2>DESCRIPTION |
| 43 |
<a name="DESCRIPTION"></a> |
| 44 |
</h2> |
| 45 |
|
| 46 |
|
| 47 |
<p style="margin-left:11%; margin-top: 1em">A |
| 48 |
<i>crontab</i> file contains instructions to the |
| 49 |
<i>bcron−sched</i>(8) daemon of the general form: |
| 50 |
‘‘run this command at this time on this |
| 51 |
date’’. Each user has their own crontab, and |
| 52 |
commands in any given crontab will be executed as the user |
| 53 |
who owns the crontab.</p> |
| 54 |
|
| 55 |
<p style="margin-left:11%; margin-top: 1em">Blank lines and |
| 56 |
leading spaces and tabs are ignored. Lines whose first |
| 57 |
non-space character is a pound-sign (#) are comments, and |
| 58 |
are ignored. Note that comments are not allowed on the same |
| 59 |
line as cron commands, since they will be taken to be part |
| 60 |
of the command. Similarly, comments are not allowed on the |
| 61 |
same line as environment variable settings.</p> |
| 62 |
|
| 63 |
<p style="margin-left:11%; margin-top: 1em">An active line |
| 64 |
in a crontab will be either an environment setting or a cron |
| 65 |
command. An environment setting is of the form,</p> |
| 66 |
|
| 67 |
<p style="margin-left:11%; margin-top: 1em">name = |
| 68 |
value</p> |
| 69 |
|
| 70 |
<p style="margin-left:11%; margin-top: 1em">where the |
| 71 |
spaces around the equal-sign (=) are optional, and any |
| 72 |
subsequent non-leading spaces in <i>value</i> will be part |
| 73 |
of the value assigned to <i>name</i>. The <i>value</i> |
| 74 |
string may be placed in quotes (single or double, but |
| 75 |
matching) to preserve leading or trailing blanks.</p> |
| 76 |
|
| 77 |
<p style="margin-left:11%; margin-top: 1em">Several |
| 78 |
environment variables are set up automatically by the |
| 79 |
<i>bcron−exec</i>(8) program. SHELL is set to /bin/sh, |
| 80 |
and LOGNAME, USER, and HOME are set from the |
| 81 |
<i>/etc/passwd</i> line of the crontab’s owner.</p> |
| 82 |
|
| 83 |
<p style="margin-left:11%; margin-top: 1em">In addition to |
| 84 |
LOGNAME, USER, HOME, and SHELL, <i>bcron−exec</i>(8) |
| 85 |
will look at MAILTO if it has any reason to send mail as a |
| 86 |
result of running commands in |
| 87 |
‘‘this’’ crontab. If MAILTO is |
| 88 |
defined (and non-empty), mail is sent to the user so named. |
| 89 |
If MAILTO is defined but empty (MAILTO=""), no |
| 90 |
mail will be sent. Otherwise mail is sent to the owner of |
| 91 |
the crontab. This option is useful if you decide on |
| 92 |
/bin/mail instead of /usr/lib/sendmail as your mailer when |
| 93 |
you install cron -- /bin/mail doesn’t do aliasing, and |
| 94 |
UUCP usually doesn’t read its mail.</p> |
| 95 |
|
| 96 |
<p style="margin-left:11%; margin-top: 1em">The format of a |
| 97 |
cron command is very much the V7 standard, with a number of |
| 98 |
upward-compatible extensions. Each line has five time and |
| 99 |
date fields, followed by a user name if this is the system |
| 100 |
crontab file, followed by a command. Commands are executed |
| 101 |
by <i>bcron−sched</i>(8) when the minute, hour, and |
| 102 |
month of year fields match the current time, <i>and</i> at |
| 103 |
least one of the two day fields (day of month, or day of |
| 104 |
week) match the current time (see |
| 105 |
‘‘Note’’ below). Jobs scheduled |
| 106 |
during non-existent times, such as "missing hours" |
| 107 |
during daylight savings conversion, will be scheduled at |
| 108 |
some point shortly after the non-existent time. Jobs |
| 109 |
scheduled during repeating times, such as "duplicate |
| 110 |
hours" during daylight savings conversion, will be |
| 111 |
scheduled only once (unless they would repeat anyways, such |
| 112 |
as jobs that run every minute or hour).</p> |
| 113 |
|
| 114 |
<p style="margin-left:11%; margin-top: 1em">The time and |
| 115 |
date fields are:</p> |
| 116 |
|
| 117 |
<table width="100%" border="0" rules="none" frame="void" |
| 118 |
cellspacing="0" cellpadding="0"> |
| 119 |
<tr valign="top" align="left"> |
| 120 |
<td width="22%"></td> |
| 121 |
<td width="1%"> |
| 122 |
|
| 123 |
|
| 124 |
<p>field</p></td> |
| 125 |
<td width="77%"> |
| 126 |
|
| 127 |
|
| 128 |
<p>allowed values</p></td></tr> |
| 129 |
<tr valign="top" align="left"> |
| 130 |
<td width="22%"></td> |
| 131 |
<td width="1%"> |
| 132 |
|
| 133 |
|
| 134 |
<p>-----</p></td> |
| 135 |
<td width="77%"> |
| 136 |
|
| 137 |
|
| 138 |
<p>--------------</p></td></tr> |
| 139 |
<tr valign="top" align="left"> |
| 140 |
<td width="22%"></td> |
| 141 |
<td width="1%"> |
| 142 |
|
| 143 |
|
| 144 |
<p>minute</p></td> |
| 145 |
<td width="77%"> |
| 146 |
|
| 147 |
|
| 148 |
<p>0-59</p></td></tr> |
| 149 |
<tr valign="top" align="left"> |
| 150 |
<td width="22%"></td> |
| 151 |
<td width="1%"> |
| 152 |
|
| 153 |
|
| 154 |
<p>hour</p></td> |
| 155 |
<td width="77%"> |
| 156 |
|
| 157 |
|
| 158 |
<p>0-23</p></td></tr> |
| 159 |
<tr valign="top" align="left"> |
| 160 |
<td width="22%"></td> |
| 161 |
<td width="1%"> |
| 162 |
|
| 163 |
|
| 164 |
<p>day of month</p></td> |
| 165 |
<td width="77%"> |
| 166 |
|
| 167 |
|
| 168 |
<p>1-31</p></td></tr> |
| 169 |
<tr valign="top" align="left"> |
| 170 |
<td width="22%"></td> |
| 171 |
<td width="1%"> |
| 172 |
|
| 173 |
|
| 174 |
<p>month</p></td> |
| 175 |
<td width="77%"> |
| 176 |
|
| 177 |
|
| 178 |
<p>1-12 (or names, see below)</p></td></tr> |
| 179 |
<tr valign="top" align="left"> |
| 180 |
<td width="22%"></td> |
| 181 |
<td width="1%"> |
| 182 |
|
| 183 |
|
| 184 |
<p>day of week</p></td> |
| 185 |
<td width="77%"> |
| 186 |
|
| 187 |
|
| 188 |
<p>0-7 (0 or 7 is Sun, or use names)</p></td></tr> |
| 189 |
</table> |
| 190 |
|
| 191 |
<p style="margin-left:11%; margin-top: 1em">A field may be |
| 192 |
an asterisk (*), which always stands for |
| 193 |
‘‘first−last’’.</p> |
| 194 |
|
| 195 |
<p style="margin-left:11%; margin-top: 1em">Ranges of |
| 196 |
numbers are allowed. Ranges are two numbers separated with a |
| 197 |
hyphen. The specified range is inclusive. For example, 8-11 |
| 198 |
for an ‘‘hours’’ entry specifies |
| 199 |
execution at hours 8, 9, 10 and 11.</p> |
| 200 |
|
| 201 |
<p style="margin-left:11%; margin-top: 1em">Lists are |
| 202 |
allowed. A list is a set of numbers (or ranges) separated by |
| 203 |
commas. Examples: ‘‘1,2,5,9’’, |
| 204 |
‘‘0-4,8-12’’.</p> |
| 205 |
|
| 206 |
<p style="margin-left:11%; margin-top: 1em">Step values can |
| 207 |
be used in conjunction with ranges. Following a range with |
| 208 |
‘‘/<number>’’ specifies skips |
| 209 |
of the number’s value through the range. For example, |
| 210 |
‘‘0-23/2’’ can be used in the hours |
| 211 |
field to specify command execution every other hour (the |
| 212 |
alternative in the V7 standard is |
| 213 |
‘‘0,2,4,6,8,10,12,14,16,18,20,22’’). |
| 214 |
Steps are also permitted after an asterisk, so if you want |
| 215 |
to say ‘‘every two hours’’, just use |
| 216 |
‘‘*/2’’.</p> |
| 217 |
|
| 218 |
<p style="margin-left:11%; margin-top: 1em">Names can also |
| 219 |
be used for the ‘‘month’’ and |
| 220 |
‘‘day of week’’ fields. Use the |
| 221 |
first three letters of the particular day or month (case |
| 222 |
doesn’t matter). Ranges or lists of names are not |
| 223 |
allowed.</p> |
| 224 |
|
| 225 |
<p style="margin-left:11%; margin-top: 1em">The |
| 226 |
‘‘sixth’’ field (the rest of the |
| 227 |
line) specifies the command to be run. The entire command |
| 228 |
portion of the line will be executed by /bin/sh or by the |
| 229 |
shell specified in the SHELL variable of the cronfile.</p> |
| 230 |
|
| 231 |
<p style="margin-left:11%; margin-top: 1em">Note: The day |
| 232 |
of a command’s execution can be specified by two |
| 233 |
fields — day of month, and day of week. If both fields |
| 234 |
are restricted (ie, aren’t *), the command will be run |
| 235 |
when <i>either</i> field matches the current time. For |
| 236 |
example, <br> |
| 237 |
‘‘30 4 1,15 * 5’’ would cause a |
| 238 |
command to be run at 4:30 am on the 1st and 15th of each |
| 239 |
month, plus every Friday.</p> |
| 240 |
|
| 241 |
<h2>EXAMPLE CRON FILE |
| 242 |
<a name="EXAMPLE CRON FILE"></a> |
| 243 |
</h2> |
| 244 |
|
| 245 |
|
| 246 |
<p style="margin-left:11%; margin-top: 1em"># use /bin/sh |
| 247 |
to run commands, no matter what /etc/passwd says <br> |
| 248 |
SHELL=/bin/sh <br> |
| 249 |
# mail any output to ‘[email protected]’, no |
| 250 |
matter whose crontab this is <br> |
| 251 |
[email protected] <br> |
| 252 |
# <br> |
| 253 |
# run five minutes after midnight, every day <br> |
| 254 |
5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out |
| 255 |
2>&1 <br> |
| 256 |
# run at 2:15pm on the first of every month -- output mailed |
| 257 |
to bruce (above) <br> |
| 258 |
15 14 1 * * $HOME/bin/monthly <br> |
| 259 |
23 0-23/2 * * * echo "run 23 minutes after midn, 2am, |
| 260 |
4am ..., everyday" <br> |
| 261 |
5 4 * * sun echo "run at 5 after 4 every |
| 262 |
sunday"</p> |
| 263 |
|
| 264 |
<h2>FILES |
| 265 |
<a name="FILES"></a> |
| 266 |
</h2> |
| 267 |
|
| 268 |
|
| 269 |
<table width="100%" border="0" rules="none" frame="void" |
| 270 |
cellspacing="0" cellpadding="0"> |
| 271 |
<tr valign="top" align="left"> |
| 272 |
<td width="11%"></td> |
| 273 |
<td width="18%"> |
| 274 |
|
| 275 |
|
| 276 |
<p style="margin-top: 1em"><i>/etc/crontab</i></p></td> |
| 277 |
<td width="13%"></td> |
| 278 |
<td width="36%"> |
| 279 |
|
| 280 |
|
| 281 |
<p style="margin-top: 1em">System crontab file</p></td> |
| 282 |
<td width="22%"> |
| 283 |
</td></tr> |
| 284 |
<tr valign="top" align="left"> |
| 285 |
<td width="11%"></td> |
| 286 |
<td width="18%"> |
| 287 |
|
| 288 |
|
| 289 |
<p><i>/etc/cron.d/</i></p></td> |
| 290 |
<td width="13%"></td> |
| 291 |
<td width="36%"> |
| 292 |
|
| 293 |
|
| 294 |
<p>System crontab directory</p></td> |
| 295 |
<td width="22%"> |
| 296 |
</td></tr> |
| 297 |
</table> |
| 298 |
|
| 299 |
<h2>SEE ALSO |
| 300 |
<a name="SEE ALSO"></a> |
| 301 |
</h2> |
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
<p style="margin-left:11%; margin-top: 1em">bcron−sched(8), |
| 306 |
bcron−spool(8), bcrontab(1)</p> |
| 307 |
|
| 308 |
<h2>EXTENSIONS |
| 309 |
<a name="EXTENSIONS"></a> |
| 310 |
</h2> |
| 311 |
|
| 312 |
|
| 313 |
<p style="margin-left:11%; margin-top: 1em">When specifying |
| 314 |
day of week, both day 0 and day 7 will be considered Sunday. |
| 315 |
BSD and ATT seem to disagree about this.</p> |
| 316 |
|
| 317 |
<p style="margin-left:11%; margin-top: 1em">Lists and |
| 318 |
ranges are allowed to co-exist in the same field. |
| 319 |
"1-3,7-9" would be rejected by ATT or BSD cron -- |
| 320 |
they want to see "1-3" or "7,8,9" |
| 321 |
ONLY.</p> |
| 322 |
|
| 323 |
<p style="margin-left:11%; margin-top: 1em">Ranges can |
| 324 |
include "steps", so "1-9/2" is the same |
| 325 |
as "1,3,5,7,9".</p> |
| 326 |
|
| 327 |
<p style="margin-left:11%; margin-top: 1em">Names of months |
| 328 |
or days of the week can be specified by name.</p> |
| 329 |
|
| 330 |
<p style="margin-left:11%; margin-top: 1em">Environment |
| 331 |
variables can be set in the crontab. In BSD or ATT, the |
| 332 |
environment handed to child processes is basically the one |
| 333 |
from /etc/rc.</p> |
| 334 |
|
| 335 |
<p style="margin-left:11%; margin-top: 1em">Command output |
| 336 |
is mailed to the crontab owner (BSD can’t do this), |
| 337 |
can be mailed to a person other than the crontab owner (SysV |
| 338 |
can’t do this), or the feature can be turned off and |
| 339 |
no mail will be sent at all (SysV can’t do this |
| 340 |
either).</p> |
| 341 |
|
| 342 |
<h2>AUTHOR |
| 343 |
<a name="AUTHOR"></a> |
| 344 |
</h2> |
| 345 |
|
| 346 |
|
| 347 |
<p style="margin-left:11%; margin-top: 1em">Paul Vixie |
| 348 |
<[email protected]> <br> |
| 349 |
Charles Cazabon <charlesc-cronman @ |
| 350 |
discworld.dyndns.org> <br> |
| 351 |
Bruce Guenter <[email protected]></p> |
| 352 |
<hr> |
| 353 |
</body> |
| 354 |
</html> |