1CRON(8) Cronie Users' Manual CRON(8)
2
3
4
6 crond - daemon to execute scheduled commands
7
9 crond [-n | -p | -s | -c | -m<mailcommand>]
10
11 crond -x [ext,sch,proc,pars,load,misc,test,bit]
12
14 Cron is started from /etc/rc.d/init.d or /etc/init.d It returns immedi‐
15 ately, thus, there is no need to need to start it with the '&' parame‐
16 ter.
17
18 Cron searches /var/spool/cron for crontab files which are named after
19 accounts in /etc/passwd; The found crontabs are loaded into the memory.
20 Cron also searches for /etc/anacrontab and any files in the /etc/cron.d
21 directory, which have a different format (see crontab(5)). Cron exam‐
22 ines all stored crontabs and checks each job to see if it needs to be
23 run in the current minute. When executing commands, any output is
24 mailed to the owner of the crontab (or to the user specified in the
25 MAILTO environment variable in the crontab, if such exists). Any job
26 output can also be sent to syslog by using the -s option.
27
28 There are two ways how changes in crontables are checked. The first
29 method is checking the modtime of a file. The second method is using
30 the inotify support. Using of inotify is logged in the /var/log/cron
31 log after the daemon is started. The inotify support checks for changes
32 in all crontables and accesses the hard disk only when a change is
33 detected.
34
35 When using the modtime option, Cron checks its crontables' modtimes
36 every minute to check for any changes and reloads the crontables which
37 have changed. There is no need to restart Cron after some of the
38 crontables were modified. The modtime option is also used when inotify
39 can not be initialized.
40
41 Cron checks these files and directories: /etc/anacrontab system
42 crontab, usually used to run daily, weekly, monthly jobs. See
43 anacrontab(5) for more details. /etc/cron.d/ directory that contains
44 system cronjobs stored for different users. /var/spool/cron directory
45 that contains user crontables created by the crontab command.
46
47 Note that the crontab(1) command updates the modtime of the spool
48 directory whenever it changes a crontab.
49
50 Daylight Saving Time and other time changes
51 Local time changes of less than three hours, such as those caused by
52 the Daylight Saving Time changes, are handled in a special way. This
53 only applies to jobs that run at a specific time and jobs that run with
54 a granularity greater than one hour. Jobs that run more frequently are
55 scheduled normally.
56
57 If time was adjusted one hour forward, those jobs that would have run
58 in the interval that has been skipped will be run immediately. Con‐
59 versely, if time was adjusted backward, running the same job twice is
60 avoided.
61
62 Time changes of more than 3 hours are considered to be corrections to
63 the clock or the timezone, and the new time is used immediately.
64
65 It is possible to use different time zones for crontables. See
66 crontab(5) for more information.
67
68 PAM Access Control
69 Cron supports access control with PAM if the system has PAM installed.
70 For more information, see pam(8). A PAM configuration file for crond
71 is installed in /etc/pam.d/crond. The daemon loads the PAM environment
72 from the pam_env module. This can be overridden by defining specific
73 settings in the appropriate crontab file.
74
76 -m This option allows you to specify a shell command to use for
77 sending Cron mail output instead of using sendmail(8) This com‐
78 mand must accept a fully formatted mail message (with headers)
79 on standard input and send it as a mail message to the recipi‐
80 ents specified in the mail headers. Specifying the string off
81 (i.e. crond -m off) will disable the sending of mail.
82
83 -n Tells the daemon to run in the foreground. This can be useful
84 when starting it out of init.
85
86 -p Allows Cron to accept any user set crontables.
87
88 -c This option enables clustering support, as described below.
89
90 -s This option will direct Cron to send the job output to the sys‐
91 tem log using syslog(3). This is useful if your system does not
92 have sendmail(8), installed or if mail is disabled.
93
94 -x This option allows you to set debug flags.
95
97 When the SIGHUP is received, the Cron daemon will close and reopen its
98 log file. This proves to be useful in scripts which rotate and age log
99 files. Naturally, this is not relevant if Cron was built to use sys‐
100 log(3).
101
103 In this version of Cron it is possible to use a network-mounted shared
104 /var/spool/cron across a cluster of hosts and specify that only one of
105 the hosts should run the crontab jobs in this directory at any one
106 time. This is done by starting Cron with the -c option, and have the
107 /var/spool/cron/.cron.hostname file contain just one line, which repre‐
108 sents the hostname of whichever host in the cluster should run the
109 jobs. If this file does not exist, or the hostname in it does not
110 match that returned by gethostname(2), then all crontab files in this
111 directory are ignored. This has no effect on cron jobs specified in
112 the /etc/crontab file or on files in the /etc/cron.d directory. These
113 files are always run and considered host-specific.
114
115 Rather than editing /var/spool/cron/.cron.hostname directly, use the -n
116 option of crontab(1) to specify the host.
117
118 You should ensure that all hosts in a cluster, and the file server from
119 which they mount the shared crontab directory, have closely synchro‐
120 nised clocks, e.g. using ntpd(8) , otherwise the results will be very
121 unpredictable.
122
123 Using cluster sharing automatically disables inotify support, because
124 inotify cannot be relied on with network-mounted shared file systems.
125
127 All crontab files have to be regular files or symlinks to regular
128 files, they must not be executable or writable for anyone else but the
129 owner. This requirement can be overridden by using the -p option on
130 the crond command line. If inotify support is in use, changes in the
131 symlinked crontabs are not automatically noticed by the cron daemon.
132 The cron daemon must receive a SIGHUP signal to reload the crontabs.
133 This is a limitation of the inotify API.
134
135 The syslog output will be used instead of mail, when sendmail is not
136 installed.
137
139 crontab(1), crontab(5), inotify(7), pam(8)
140
142 Paul Vixie <vixie@isc.org>
143 Marcela Mašláňová <mmaslano@redhat.com>
144 Colin Dean <colin@colin-dean.org>
145
146
147
148Marcela Mašláňová July 2010 CRON(8)