\" $NetBSD: cron.8,v 1.5 2011/10/12 22:50:31 wiz Exp $
\"
\" Id: cron.8,v 1.8 2004/01/23 19:03:32 vixie Exp
\"
Dd October 12, 2011
Dt CRON 8
Os
Sh NAME
Nm cron
Nd daemon to execute scheduled commands (ISC Cron V4.1)
Sh SYNOPSIS
Nm
Op Fl n
Op Fl x Ar debugflags
Sh DESCRIPTION
Nm
is normally started during system boot by
Xr rc.d 8
framework, if cron is switched on in
Xr rc.conf 5 .
Pp
It will return immediately so you don't have to start it with
Sq \*[Am] .
Pp
Nm
searches
Pa /var/cron/tabs
for crontab files which are named after accounts in
Pa /etc/passwd .
Crontabs found are loaded into memory.
Nm
also searches for
Pa /etc/crontab
which is in a different format (see
Xr crontab 5 ) .
Finally
Nm
looks for crontabs in
Pa /etc/cron.d
if it exists, and executes each file as a crontab.
Pp
When
Nm
looks in a directory for crontabs (either in
Pa /var/cron/tabs
or
Pa /etc/cron.d )
it will not process files that:
Bl -dash -compact -offset indent
It
Start with a
Sq \&.
or a
Sq # .
It
End with a
Sq ~
or with
Dq .rpmsave ,
Dq .rpmorig ,
or
Dq .rpmnew .
It
Are of zero length.
It
Their length is greater than
Dv MAXNAMLEN .
El
Pp
Nm
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
Ev MAILTO
environment variable in the crontab, if such exists).
Pp
Events such as
Dv START
and
Dv FINISH
are recorded in the
Pa /var/log/cron
log file with date and time details.
This information is useful for a number of reasons, such as
determining the amount of time required to run a particular job.
By default, root has an hourly job that rotates these log files
with compression to preserve disk space.
Pp
Additionally,
Nm
checks each minute to see if its spool directory's modtime (or the modtime
on
Pa /etc/crontab
or
Pa /etc/cron.d )
has changed, and if it has,
Nm
will then examine the modtime on all crontabs and reload those which have
changed.
Thus
Nm
need not be restarted whenever a crontab file is modified.
Note that the
Xr crontab 1
command updates the modtime of the spool directory whenever it changes a
crontab.
Pp
The following options are available:
Bl -tag -width indent
It Fl x
This flag turns on some debugging flags.
Ar debugflags
is comma-separated list of debugging flags to turn on.
If a flag is turned on,
Nm
writes some additional debugging information to system log during
its work.
Available debugging flags are:
Bl -tag -width proc -compact
It Ar sch
scheduling
It Ar proc
process control
It Ar pars
parsing
It Ar load
database loading
It Ar misc
miscellaneous
It Ar test
test mode - do not actually execute any commands
It Ar bit
show how various bits are set (long)
It Ar ext
print extended debugging information
El
It Fl n
Stay in the foreground and don't daemonize
Nm .
El
Sh Daylight Saving Time and other time changes
Local time changes of less than three hours, such as those caused
by the start or end of Daylight Saving Time, are handled specially.
This only applies to jobs that run at a specific time and jobs that
are run with a granularity greater than one hour.
Jobs that run more frequently are scheduled normally.
Pp
If time has moved forward, those jobs that would have run in the
interval that has been skipped will be run immediately.
Conversely, if time has moved backward, care is taken to avoid running
jobs twice.
Pp
Time changes of more than 3 hours are considered to be corrections to
the clock or timezone, and the new time is used immediately.
Sh SIGNALS
On receipt of a
Dv SIGHUP ,
the cron daemon will close and reopen its
log file.
This is useful in scripts which rotate and age log files.
Naturally this is not relevant if cron was built to use
Xr syslog 3 .
Sh FILES
Bl -tag -width /var/cron/tabs -compact
It Pa /var/cron/tabs
Nm
spool directory
It Pa /etc/crontab
system crontab file
It Pa /etc/cron.d/
system crontab directory
It Pa /var/log/cron
log file for cron events
El
Sh SEE ALSO
Xr crontab 1 ,
Xr crontab 5
Sh AUTHORS
An Paul Vixie
Aq
[email protected]