Debian Codegraph @

upstream/debian-unstable/man8/cron.8

raw
1 '\" t
2 .\" Title: Cron
3 .\" Author: Paul Vixie <[email protected]>
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\" Date: 2026-04-27
6 .\" Manual: cron User Manual
7 .\" Source: cron
8 .\" Language: English
9 .\"
10 .TH "CRON" "8" "2026\-04\-27" "cron" "cron User Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 cron \- daemon to execute scheduled commands (Vixie Cron)
32 .SH "SYNOPSIS"
33 .HP \w'\fBcron\fR\ 'u
34 \fBcron\fR [\fB\-f\fR] [\fB\-l\fR] [\fB\-L\ \fR\fB\fIloglevel\fR\fR] [\fB\-n\ \fR\fB\fIfqdn\fR\fR] [\fB\-x\ \fR\fB\fIdebugflags\fR\fR]
35 .HP \w'\fBcron\fR\ 'u
36 \fBcron\fR [\fB\-N\fR]
37 .SH "DESCRIPTION"
38 .PP
39 \fBcron\fR
40 is directly invoked by
41 \fBsystemd\fR(1)
42 on entering multi\-user runlevels\&.
43 .SH "OPTIONS"
44 .PP
45 \fB\-f\fR
46 .RS 4
47 Stay in foreground mode, don\*(Aqt daemonize\&.
48 .RE
49 .PP
50 \fB\-l\fR
51 .RS 4
52 Enable LSB compliant names for /etc/cron\&.d files\&. This setting, however, does not affect the parsing of files under
53 \fI/etc/cron\&.hourly\fR,
54 \fI/etc/cron\&.daily\fR,
55 \fI/etc/cron\&.weekly\fR
56 or
57 \fI/etc/cron\&.monthly\fR\&.
58 .RE
59 .PP
60 \fB\-n \fR\fB\fIfqdn\fR\fR
61 .RS 4
62 Include the FQDN in the subject when sending mails\&. By default,
63 \fBcron\fR
64 will abbreviate the hostname\&.
65 .RE
66 .PP
67 \fB\-N \fR
68 .RS 4
69 Run cron jobs Now, immediately, and exit\&. This option is useful to perform tests\&.
70 .RE
71 .PP
72 \fB\-L \fR\fB\fIloglevel\fR\fR
73 .RS 4
74 Tell
75 \fBcron\fR
76 what to log about
77 \fIjobs\fR
78 (errors are logged regardless of this value) as the sum of the following values:
79 .PP
80 1
81 .RS 4
82 will log the start of all cron jobs
83 .RE
84 .PP
85 2
86 .RS 4
87 will log the end of all cron jobs
88 .RE
89 .PP
90 4
91 .RS 4
92 will log all failed jobs (exit status != 0)
93 .RE
94 .PP
95 8
96 .RS 4
97 will log the process number of all cron jobs
98 .RE
99 .sp
100 The default is to log the start of all jobs (1)\&. Logging will be disabled if
101 \fIloglevel\fR
102 is set to zero (0)\&. A value of fifteen (15) will select all options\&.
103 .RE
104 .PP
105 \fB\-x \fR\fB\fIdebugflags\fR\fR
106 .RS 4
107 Tell
108 \fBcron\fR
109 to be more verbose and output debugging information; debugflags is the sum of those values:
110 .PP
111 1
112 .RS 4
113 "ext": \&.\&.\&.
114 .RE
115 .PP
116 2
117 .RS 4
118 "sch": \&.\&.\&.
119 .RE
120 .PP
121 4
122 .RS 4
123 "proc": \&.\&.\&.
124 .RE
125 .PP
126 8
127 .RS 4
128 "pars": \&.\&.\&.
129 .RE
130 .PP
131 16
132 .RS 4
133 "load": \&.\&.
134 .RE
135 .PP
136 32
137 .RS 4
138 "misc": \&.\&.\&.
139 .RE
140 .PP
141 64
142 .RS 4
143 "test": \&.\&.\&.
144 .RE
145 .PP
146 128
147 .RS 4
148 "bit": \&.\&.\&.
149 .RE
150 .sp
151 .RE
152 .SH "NOTES"
153 .PP
154 \fBcron\fR
155 searches its spool area (\fI/var/spool/cron/crontabs/\fR) for crontab files (which are named after accounts in
156 \fI/etc/passwd\fR); crontabs found are loaded into memory\&. Note that crontabs in this directory should not be accessed directly \- the
157 \fBcrontab\fR(1)
158 command should be used to access and update them\&.
159 .PP
160 \fBcron\fR
161 also reads
162 \fI/etc/crontab\fR, which is in a slightly different format (see
163 \fBcrontab\fR(5))\&. In Debian, the content of
164 \fI/etc/crontab\fR
165 is predefined to run programs under
166 \fI/etc/cron\&.hourly\fR,
167 \fI/etc/cron\&.daily\fR,
168 \fI/etc/cron\&.weekly\fR
169 and
170 \fI/etc/cron\&.monthly\fR\&. This configuration is specific to Debian, see the note under
171 \fIDEBIAN SPECIFIC\fR
172 below\&.
173 .PP
174 Additionally, in Debian,
175 \fBcron\fR
176 reads the files in the
177 \fI/etc/cron\&.d\fR
178 directory\&.
179 \fBcron\fR
180 treats the files in
181 \fI/etc/cron\&.d\fR
182 as in the same way as the
183 \fI/etc/crontab\fR
184 file (they follow the special format of that file, i\&.e\&. they include the
185 \fIuser\fR
186 field)\&. However, they are independent of
187 \fI/etc/crontab\fR: they do not, for example, inherit environment variable settings from it\&. This change is specific to Debian see the note under
188 \fIDEBIAN SPECIFIC\fR
189 below\&.
190 .PP
191 Like
192 \fI/etc/crontab\fR, the files in the
193 \fI/etc/cron\&.d\fR
194 directory are monitored for changes\&. The system administrator may create cron jobs in
195 \fI/etc/cron\&.d/\fR
196 with file names like "local" or "local\-foo"\&.
197 .PP
198 \fI/etc/crontab\fR
199 and the files in
200 \fI/etc/cron\&.d\fR
201 must be owned by root, and must not be group\- or other\-writable\&. In contrast to the spool area, the files under
202 \fI/etc/cron\&.d\fR
203 or the files under
204 \fI/etc/cron\&.hourly\fR,
205 \fI/etc/cron\&.daily\fR,
206 \fI/etc/cron\&.weekly\fR
207 and
208 \fI /etc/cron\&.monthly\fR
209 may also be symlinks, provided that both the symlink and the file it points to are owned by root\&. The files under
210 \fI/etc/cron\&.d\fR
211 do not need to be executable, while the files under
212 \fI/etc/cron\&.hourly\fR,
213 \fI/etc/cron\&.daily\fR,
214 \fI/etc/cron\&.weekly\fR
215 and
216 \fI/etc/cron\&.monthly\fR
217 do, as they are run by run\-parts (see
218 \fBrun-parts\fR(8)
219 for more information)\&.
220 .PP
221 \fBcron\fR
222 then wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute\&. When executing commands, any output is mailed to the owner of the crontab (or to the user named in the
223 \fBMAILTO\fR
224 environment variable in the crontab, if such exists) from the owner of the crontab (or from the email address given in the
225 \fBMAILFROM\fR
226 environment variable in the crontab, if such exists)\&. The children copies of cron running these processes have their name coerced to uppercase, as will be seen in the syslog and
227 \fBps\fR(1)
228 output\&.
229 .PP
230 Additionally,
231 \fBcron\fR
232 checks each minute to see if its spool directory\*(Aqs modtime (or the modtime on the
233 \fI/etc/crontab\fR
234 file) has changed, and if it has,
235 \fBcron\fR
236 will then examine the modtime on all crontabs and reload those which have changed\&. Thus
237 \fBcron\fR
238 need not be restarted whenever a crontab file is modified\&. Note that the
239 \fBcrontab\fR(1)
240 command updates the modtime of the spool directory whenever it changes a crontab\&.
241 .PP
242 Special considerations exist when the clock is changed by less than 3 hours, for example at the beginning and end of daylight savings time\&. If the time has moved forwards, those jobs which would have run in the time that was skipped will be run soon after the change\&. Conversely, if the time has moved backwards by less than 3 hours, those jobs that fall into the repeated time will not be re\-run\&.
243 .PP
244 Only jobs that run at a particular time (not specified as @hourly, nor with \*(Aq*\*(Aq in the hour or minute specifier) are affected\&. Jobs which are specified with wildcards are run based on the new time immediately\&.
245 .PP
246 Clock changes of more than 3 hours are considered to be corrections to the clock, and the new time is used immediately\&.
247 .PP
248 \fBcron\fR
249 logs its action to the syslog facility \*(Aqcron\*(Aq, and logging may be controlled using the standard
250 \fBsyslogd\fR(8)
251 facility\&.
252 .SH "ENVIRONMENT"
253 .PP
254 If configured in
255 \fI/etc/default/cron\fR
256 in Debian systems, the
257 \fBcron\fR
258 daemon localisation settings environment can be managed through the use of
259 \fI/etc/environment\fR
260 or through the use of
261 \fI/etc/default/locale\fR
262 with values from the latter overriding values from the former\&. These files are read and they will be used to setup the
263 \fBLANG\fR,
264 \fBLC_ALL\fR, and
265 \fBLC_CTYPE\fR
266 environment variables\&. These variables are then used to set the charset of mails, which defaults to \*(AqC\*(Aq\&.
267 .PP
268 This does
269 \fINOT\fR
270 affect the environment of tasks running under
271 \fBcron\fR\&. For more information on how to modify the environment of tasks, consult
272 \fBcrontab\fR(5)\&.
273 .PP
274 The daemon will use, if present, the definition from
275 \fI/etc/localtime\fR
276 for the timezone\&.
277 .PP
278 The environment can be redefined in user\*(Aqs crontab definitions but
279 \fBcron\fR
280 will only handle tasks in a single timezone\&.
281 .SH "DEBIAN SPECIFIC"
282 .PP
283 Debian introduces some changes to
284 \fBcron\fR
285 that were not originally available upstream\&. The most significant changes introduced are:
286 .sp
287 .RS 4
288 .ie n \{\
289 \h'-04'\(bu\h'+03'\c
290 .\}
291 .el \{\
292 .sp -1
293 .IP \(bu 2.3
294 .\}
295 Support for
296 \fI/etc/cron\&.{hourly,daily,weekly,monthly}\fR
297 via\fI/etc/crontab\fR,
298 .RE
299 .sp
300 .RS 4
301 .ie n \{\
302 \h'-04'\(bu\h'+03'\c
303 .\}
304 .el \{\
305 .sp -1
306 .IP \(bu 2.3
307 .\}
308 Support for
309 \fI/etc/cron\&.d\fR
310 (drop\-in dir for package crontabs),
311 .RE
312 .sp
313 .RS 4
314 .ie n \{\
315 \h'-04'\(bu\h'+03'\c
316 .\}
317 .el \{\
318 .sp -1
319 .IP \(bu 2.3
320 .\}
321 PAM support,
322 .RE
323 .sp
324 .RS 4
325 .ie n \{\
326 \h'-04'\(bu\h'+03'\c
327 .\}
328 .el \{\
329 .sp -1
330 .IP \(bu 2.3
331 .\}
332 SELinux support,
333 .RE
334 .sp
335 .RS 4
336 .ie n \{\
337 \h'-04'\(bu\h'+03'\c
338 .\}
339 .el \{\
340 .sp -1
341 .IP \(bu 2.3
342 .\}
343 auditlog support,
344 .RE
345 .sp
346 .RS 4
347 .ie n \{\
348 \h'-04'\(bu\h'+03'\c
349 .\}
350 .el \{\
351 .sp -1
352 .IP \(bu 2.3
353 .\}
354 DST and other time\-related changes/fixes,
355 .RE
356 .sp
357 .RS 4
358 .ie n \{\
359 \h'-04'\(bu\h'+03'\c
360 .\}
361 .el \{\
362 .sp -1
363 .IP \(bu 2.3
364 .\}
365 SGID crontab(1) instead of SUID root,
366 .RE
367 .sp
368 .RS 4
369 .ie n \{\
370 \h'-04'\(bu\h'+03'\c
371 .\}
372 .el \{\
373 .sp -1
374 .IP \(bu 2.3
375 .\}
376 Debian\-specific file locations and commands,
377 .RE
378 .sp
379 .RS 4
380 .ie n \{\
381 \h'-04'\(bu\h'+03'\c
382 .\}
383 .el \{\
384 .sp -1
385 .IP \(bu 2.3
386 .\}
387 Debian\-specific configuration (/etc/default/cron),
388 .RE
389 .sp
390 .RS 4
391 .ie n \{\
392 \h'-04'\(bu\h'+03'\c
393 .\}
394 .el \{\
395 .sp -1
396 .IP \(bu 2.3
397 .\}
398 numerous other smaller features and fixes\&.
399 .RE
400 .PP
401 Support for
402 \fI/etc/cron\&.hourly\fR,
403 \fI/etc/cron\&.daily\fR,
404 \fI/etc/cron\&.weekly\fR
405 and
406 \fI/etc/cron\&.monthly\fR
407 is provided in Debian through the default setting of the
408 \fI/etc/crontab\fR
409 file (see the system\-wide example in
410 \fBcrontab\fR(5))\&. The default system\-wide crontab contains four tasks: run every hour, every day, every week and every month\&. Each of these tasks will execute
411 \fBrun-parts\fR(8)
412 providing each one of the directories as an argument\&. These tasks are disabled if
413 \fBanacron\fR(8)
414 is installed (except for the hourly task) to prevent conflicts between both daemons\&.
415 .PP
416 As described above, the files under these directories have to pass some sanity checks including the following: be executable, be owned by root, not be writable by group or other and, if symlinks, point to files owned by root\&. Additionally, the file names must conform to the filename requirements of
417 \fBrun-parts\fR(8): they must be entirely made up of letters, digits and can only contain the special signs underscores (\*(Aq_\*(Aq) and hyphens (\*(Aq\-\*(Aq)\&. Any file that does not conform to these requirements will not be executed by
418 \fBrun-parts\fR(8)\&. For example, any file containing dots will be ignored\&. This is done to prevent cron from running any of the files that are left by the Debian package management system when handling files in /etc/cron\&.d/ as configuration files (i\&.e\&. files ending in \&.dpkg\-dist, \&.dpkg\-orig, \&.dpkg\-old, and \&.dpkg\-new)\&.
419 .PP
420 This feature can be used by system administrators and packages to include tasks that will be run at defined intervals\&. Files created by packages in these directories should be named after the package that supplies them\&.
421 .PP
422 Support for
423 \fI/etc/cron\&.d\fR
424 is included in the
425 \fBcron\fR
426 daemon itself, which handles this location as the system\-wide crontab spool\&. This directory can contain any file defining tasks following the format used in
427 \fI/etc/crontab\fR, i\&.e\&. unlike the user cron spool, these files must provide the username to run the task as in the task definition\&.
428 .PP
429 Files in this directory have to be owned by root, do not need to be executable (they are configuration files, just like
430 \fI/etc/crontab\fR) and must conform to the same naming convention as used by
431 \fBrun-parts\fR(8)
432 : they must consist solely of upper\- and lower\-case letters, digits, underscores, and hyphens\&. This means that they
433 \fIcannot\fR
434 contain any dots\&. If the
435 \fB\-l\fR
436 option is specified to
437 \fBcron\fR
438 (this option can be setup through
439 \fI/etc/default/cron\fR, see below), then they must conform to the LSB namespace specification, exactly as in the
440 \fI\-\-lsbsysinit\fR
441 option in
442 \fBrun-parts\fR(8)\&.
443 .PP
444 The intended purpose of this feature is to allow packages that require finer control of their scheduling than the
445 \fI/etc/cron\&.{hourly,daily,weekly,monthly}\fR
446 directories to add a crontab file to
447 \fI/etc/cron\&.d\fR\&. Such files should be named after the package that supplies them\&.
448 .PP
449 Also, the default configuration of
450 \fBcron\fR
451 is controlled by
452 \fI/etc/default/cron\fR
453 which is read by the init\&.d script that launches the
454 \fBcron\fR
455 daemon\&. This file determines whether cron will read the system\*(Aqs environment variables and makes it possible to add additional options to the
456 \fBcron\fR
457 program before it is executed, either to configure its logging or to define how it will treat the files under
458 \fI/etc/cron\&.d\fR\&.
459 .SH "SEE ALSO"
460 .PP
461 \fBcrontab\fR(1),
462 \fBcrontab\fR(5),
463 \fBrun-parts\fR(8)
464 .SH "AUTHORS"
465 .PP
466 \fBPaul Vixie\fR <\&paul@vix\&.com\&>
467 .RS 4
468 Wrote this manpage (1994)\&.
469 .RE
470 .PP
471 \fBSteve Greenland\fR <\&stevegr@debian\&.org\&>
472 .RS 4
473 Maintained the package (1996\-2005)\&.
474 .RE
475 .PP
476 \fBJavier Fern\('andez\-Sanguino Pe\(~na\fR <\&jfs@debian\&.org\&>
477 .RS 4
478 Maintained the package (2005\-2014)\&.
479 .RE
480 .PP
481 \fBChristian Kastner\fR <\&ckk@debian\&.org\&>
482 .RS 4
483 Maintained the package (2010\-2016)\&.
484 .RE
485 .PP
486 \fBGeorges Khaznadar\fR <\&georgesk@debian\&.org\&>
487 .RS 4
488 Maintained the package (2022\-2024)\&.
489 .RE
490 .SH "COPYRIGHT"
491 .br
492 Copyright \(co 1994 Paul Vixie
493 .br
494 .PP
495 Distribute freely, except: don\*(Aqt remove my name from the source or documentation (don\*(Aqt take credit for my work), mark your changes (don\*(Aqt get me blamed for your possible bugs), don\*(Aqt alter or remove this notice\&. May be sold if buildable source is provided to buyer\&. No warranty of any kind, express or implied, is included with this software; use at your own risk, responsibility for damages (if any) to anyone resulting from the use of this software rests entirely with the user\&.
496 .PP
497 Since year 1994, many modifications were made in this manpage, authored by Debian Developers which maintained
498 cron(TM); above is a short list, more information can be found in the file
499 \fI/usr/share/doc/cron/copyright\fR\&.
500 .sp