NetBSD/usr.sbin/cron/cron.8

130 lines
3.3 KiB
Groff

.\" $NetBSD: cron.8,v 1.8 2007/12/29 13:21:57 wiz Exp $
.\"
.\"/* Copyright 1988,1990,1993 by Paul Vixie
.\" * All rights reserved
.\" *
.\" * Distribute freely, except: don't remove my name from the source or
.\" * documentation (don't take credit for my work), mark your changes (don't
.\" * get me blamed for your possible bugs), don't alter or remove this
.\" * notice. May be sold if buildable source is provided to buyer. No
.\" * warrantee of any kind, express or implied, is included with this
.\" * software; use at your own risk, responsibility for damages (if any) to
.\" * anyone resulting from the use of this software rests entirely with the
.\" * user.
.\" *
.\" * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
.\" * I'll try to keep a version up to date. I can be reached as follows:
.\" * Paul Vixie <paul@vix.com> uunet!decwrl!vixie!paul
.\" */
.\"
.\" Id: cron.8,v 2.2 1993/12/28 08:34:43 vixie Exp
.\"
.Dd December 29, 2007
.Dt CRON 8
.Os
.Sh NAME
.Nm cron
.Nd daemon to execute scheduled commands (Vixie Cron)
.Sh SYNOPSIS
.Nm
.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
.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 ) .
.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 )
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
.Fl x
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
.Sh FILES
.Bl -tag -width /var/cron/tabs -compact
.It Pa /var/cron/tabs
.Nm
spool directory
.It Pa /etc/crontab
system crontab
.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 paul@vix.com