1.\" $NetBSD: cron.8,v 1.5 2011/10/12 22:50:31 wiz Exp $ 2.\" 3.\" Id: cron.8,v 1.8 2004/01/23 19:03:32 vixie Exp 4.\" 5.Dd October 12, 2011 6.Dt CRON 8 7.Os 8.Sh NAME 9.Nm cron 10.Nd daemon to execute scheduled commands (ISC Cron V4.1) 11.Sh SYNOPSIS 12.Nm 13.Op Fl n 14.Op Fl x Ar debugflags 15.Sh DESCRIPTION 16.Nm 17is normally started during system boot by 18.Xr rc.d 8 19framework, if cron is switched on in 20.Xr rc.conf 5 . 21.Pp 22It will return immediately so you don't have to start it with 23.Sq \*[Am] . 24.Pp 25.Nm 26searches 27.Pa /var/cron/tabs 28for crontab files which are named after accounts in 29.Pa /etc/passwd . 30Crontabs found are loaded into memory. 31.Nm 32also searches for 33.Pa /etc/crontab 34which is in a different format (see 35.Xr crontab 5 ) . 36Finally 37.Nm 38looks for crontabs in 39.Pa /etc/cron.d 40if it exists, and executes each file as a crontab. 41.Pp 42When 43.Nm 44looks in a directory for crontabs (either in 45.Pa /var/cron/tabs 46or 47.Pa /etc/cron.d ) 48it will not process files that: 49.Bl -dash -compact -offset indent 50.It 51Start with a 52.Sq \&. 53or a 54.Sq # . 55.It 56End with a 57.Sq ~ 58or with 59.Dq .rpmsave , 60.Dq .rpmorig , 61or 62.Dq .rpmnew . 63.It 64Are of zero length. 65.It 66Their length is greater than 67.Dv MAXNAMLEN . 68.El 69.Pp 70.Nm 71then wakes up every minute, examining all stored crontabs, checking each 72command to see if it should be run in the current minute. 73When executing commands, any output is mailed to the owner of the 74crontab (or to the user named in the 75.Ev MAILTO 76environment variable in the crontab, if such exists). 77.Pp 78Events such as 79.Dv START 80and 81.Dv FINISH 82are recorded in the 83.Pa /var/log/cron 84log file with date and time details. 85This information is useful for a number of reasons, such as 86determining the amount of time required to run a particular job. 87By default, root has an hourly job that rotates these log files 88with compression to preserve disk space. 89.Pp 90Additionally, 91.Nm 92checks each minute to see if its spool directory's modtime (or the modtime 93on 94.Pa /etc/crontab 95or 96.Pa /etc/cron.d ) 97has changed, and if it has, 98.Nm 99will then examine the modtime on all crontabs and reload those which have 100changed. 101Thus 102.Nm 103need not be restarted whenever a crontab file is modified. 104Note that the 105.Xr crontab 1 106command updates the modtime of the spool directory whenever it changes a 107crontab. 108.Pp 109The following options are available: 110.Bl -tag -width indent 111.It Fl x 112This flag turns on some debugging flags. 113.Ar debugflags 114is comma-separated list of debugging flags to turn on. 115If a flag is turned on, 116.Nm 117writes some additional debugging information to system log during 118its work. 119Available debugging flags are: 120.Bl -tag -width proc -compact 121.It Ar sch 122scheduling 123.It Ar proc 124process control 125.It Ar pars 126parsing 127.It Ar load 128database loading 129.It Ar misc 130miscellaneous 131.It Ar test 132test mode - do not actually execute any commands 133.It Ar bit 134show how various bits are set (long) 135.It Ar ext 136print extended debugging information 137.El 138.It Fl n 139Stay in the foreground and don't daemonize 140.Nm . 141.El 142.Sh Daylight Saving Time and other time changes 143Local time changes of less than three hours, such as those caused 144by the start or end of Daylight Saving Time, are handled specially. 145This only applies to jobs that run at a specific time and jobs that 146are run with a granularity greater than one hour. 147Jobs that run more frequently are scheduled normally. 148.Pp 149If time has moved forward, those jobs that would have run in the 150interval that has been skipped will be run immediately. 151Conversely, if time has moved backward, care is taken to avoid running 152jobs twice. 153.Pp 154Time changes of more than 3 hours are considered to be corrections to 155the clock or timezone, and the new time is used immediately. 156.Sh SIGNALS 157On receipt of a 158.Dv SIGHUP , 159the cron daemon will close and reopen its 160log file. 161This is useful in scripts which rotate and age log files. 162Naturally this is not relevant if cron was built to use 163.Xr syslog 3 . 164.Sh FILES 165.Bl -tag -width /var/cron/tabs -compact 166.It Pa /var/cron/tabs 167.Nm 168spool directory 169.It Pa /etc/crontab 170system crontab file 171.It Pa /etc/cron.d/ 172system crontab directory 173.It Pa /var/log/cron 174log file for cron events 175.El 176.Sh SEE ALSO 177.Xr crontab 1 , 178.Xr crontab 5 179.Sh AUTHORS 180.An Paul Vixie 181.Aq vixie@isc.org 182