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