CRON(8) | System Manager's Manual | CRON(8) |
cron
—
cron |
[-n ] [-x
debugflags] |
cron
is normally started during system boot by
rc.d(8) framework, if cron is
switched on in rc.conf(5).
It will return immediately so you don't have to start it with ‘&’.
cron
searches
/var/cron/tabs for crontab files which are named
after accounts in /etc/passwd. Crontabs found are
loaded into memory. cron
also searches for
/etc/crontab which is in a different format (see
crontab(5)). Finally
cron
looks for crontabs in
/etc/cron.d if it exists, and executes each file as
a crontab.
When cron
looks in a directory for
crontabs (either in /var/cron/tabs or
/etc/cron.d) it will not process files that:
MAXNAMLEN
.cron
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 MAILTO
environment variable in the crontab, if such exists).
Events such as START
and
FINISH
are recorded in the
/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.
Additionally, cron
checks each minute to
see if its spool directory's modtime (or the modtime on
/etc/crontab or /etc/cron.d)
has changed, and if it has, cron
will then examine
the modtime on all crontabs and reload those which have changed. Thus
cron
need not be restarted whenever a crontab file
is modified. Note that the
crontab(1) command updates
the modtime of the spool directory whenever it changes a crontab.
The following options are available:
-x
cron
writes some additional debugging
information to system log during its work. Available debugging flags are:
-n
cron
.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.
Time changes of more than 3 hours are considered to be corrections to the clock or timezone, and the new time is used immediately.
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
syslog(3).
cron
spool directoryOctober 12, 2011 | NetBSD 9.4 |