only ReadTimestamps for updated crontabs
[yacron.git] / crond.8
blob9b862168acf16f5a3750f263934595c44e4686bb
1 .\" Copyright 1994 Matthew Dillon (dillon@apollo.backplane.com)
2 .\" Copyright 2009 James Pryor <profjim@jimpryor.net>
3 .\" May be distributed under the GNU General Public License
4 .TH CROND 8 "21 Aug 2009"
5 .SH NAME
6 crond \- cron daemon (Yet Another Cron)
7 .SH SYNOPSIS
8 .B crond [-l loglevel] [-L [logfile]|-S] [-M mailscript] [-m mailto] [-d|-f|-b] [-s systemdir] [-c crondir] [-t timestamps]
9 .SH OPTIONS
10 .B crond
11 is a background daemon that parses individual crontab files and
12 executes commands on behalf of the users in question.
13 .TP 0.5i
14 .B "-l loglevel "
15 set logging level, default is <= notice = 5.
16 .PP 0.5i
17 Valid level names are as described in logger.1 and syslog.3:
18 alert, crit, debug, emerg, err, error (deprecated synonym for err), info,
19 notice, panic (deprecated synonym for emerg), warning, warn (deprecated synonym
20 for warning).
21 .TP 0.5i
22 .B "-L [logfile] "
23 log to specified file (if none supplied, uses /var/log/crond.log).
24 .TP 0.5i
25 .B "-S "
26 use syslogd (default).
27 .TP 0.5i
28 .B "-M mailscript "
29 receives any cron job output as stdin (default is /usr/sbin/sendmail).
30 .TP 0.5i
31 .B "-m mailto "
32 address to mail any cron output to (default is local user).
33 .TP 0.5i
34 .B "-d "
35 turn on debugging. This option sets the logging level to <= debug and causes crond
36 to run in the foreground.
37 .TP 0.5i
38 .B "-f "
39 run crond in the foreground.
40 .TP 0.5i
41 .B "-b "
42 run crond in the background (default unless -d or -f is specified).
43 .TP 0.5i
44 .B "-s systemdir "
45 specify directory containing system-wide crontab files (default is /etc/cron.d).
46 .TP 0.5i
47 .B "-c crondir "
48 specify crontab spool directory (default is /var/spool/cron/crontabs).
49 .TP 0.5i
50 .B "-t timestamps "
51 specify directory containing cron timestamps for @freq jobs (default is /var/spool/cron/timestamps).
52 .SH DESCRIPTION
53 .B crond
54 is responsible for scanning the crontab files and running
55 their commands at the appropriate time.  The
56 .B crontab
57 program communicates with crond through the "cron.update" file
58 which resides in the crontabs directory, usually /var/spool/cron/crontabs.
59 This is accomplished by appending the filename of the modified or
60 deleted crontab file to "cron.update" which crond then picks up to
61 resynchronize or remove its internal representation of the file.
62 .PP
63 Whenever the "cron.update" file is seen, crond also re-reads all of
64 timestamp files from disk. Normally these will just mirror crond's own
65 internal representations, but this mechanism could be used to externally
66 update the timestamps.
67 .PP
68 The "cron.update" file can also be used to instruct crond to schedule
69 a named job. Each line in this file should have the format:
70 .TP 0.5i
71 user    job1    !job2
72 .PP
73 to request that user's job1 should be scheduled (waiting first for the 
74 successful completion of any jobs named in job1's AFTER= argument), and
75 job2 should also be scheduled (without waiting for other jobs).
77 .PP
78 .B crond
79 has a number of built in limitations to reduce the chance of it being
80 ill-used.  Potentially infinite loops during parsing are dealt with
81 via a failsafe counter, and user crontabs are generally limited to
82 256 crontab entries.  Crontab lines may not be longer than 1024
83 characters, including the newline.
84 .PP
85 Whenever crond must run a job, it first creates a daemon-owned temporary
86 file O_EXCL and O_APPEND to store any output, then fork()s and changes
87 its user and group permissions to match that of the user the job is being
88 run for, then exec's /bin/sh -c to run the job.  The temporary file remains
89 under the ownership of the daemon to prevent the user from tampering with
90 it.  Upon job completion, crond verifies the secureness of the mail file
91 and, if it has been appended to, mails to the file to user.  The
92 .B sendmail
93 program (or custom mailscript, if supplied) is run under the user's uid to prevent mail related security holes.
94 .PP
95 When the
96 .B crontab
97 program allows a user to edit his crontab, it copies the crontab to a user
98 owned file before running the user's prefered editor.  The suid
99 .B crontab
100 keeps an open descriptor to the file which it later uses to
101 copy the file back, thereby ensuring the user has not tampered with the
102 file type.
103 Unlike
104 .B crontab,
106 .B crond
107 program does not leave an open descriptor to the file for the
108 duration of the job's execution as this might cause crond to run out
109 of descriptors.
111 .B Crond
112 always synchronizes to the top of the minute, checking the current time
113 against the list of possible jobs.  The list is stored such that the
114 scan goes very quickly, and crond can deal with several thousand entries
115 without taking any noticable amount of cpu.
116 .SH AUTHORS
117 Matthew Dillon (dillon@apollo.backplane.com)
119 James Pryor (profjim@jimpryor.net)