'\" te
.\"  Copyright 1989 AT&T Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH CRON 1M "Feb 4, 2009"
.SH NAME
cron \- clock daemon
.SH SYNOPSIS
.LP
.nf
\fB/usr/sbin/cron\fR
.fi

.SH DESCRIPTION
.sp
.LP
\fBcron\fR starts a process that executes commands at specified dates and
times.
.sp
.LP
You can specify regularly scheduled commands to \fBcron\fR according to
instructions found in \fBcrontab\fR files in the directory
\fB/var/spool/cron/crontabs\fR. Users can submit their own \fBcrontab\fR file
using the \fBcrontab\fR(1) command. Commands which are to be executed only once
can be submitted using the \fBat\fR(1) command.
.sp
.LP
\fBcron\fR only examines \fBcrontab\fR or \fBat\fR command files during its own
process initialization phase and when the \fBcrontab\fR or \fBat\fR command is
run. This reduces the overhead of checking for new or changed files at
regularly scheduled intervals.
.sp
.LP
As \fBcron\fR never exits, it should be executed only once. This is done
routinely by way of the \fBsvc:/system/cron:default\fR service. The file
\fB/etc/cron.d/FIFO\fR file is used as a lock file to prevent the execution of
more than one instance of \fBcron\fR.
.sp
.LP
\fBcron\fR captures the output of the job's \fBstdout\fR and \fBstderr\fR
streams, and, if it is not empty, mails the output to the user. If the job does
not produce output, no mail is sent to the user. An exception is if the job is
an \fBat\fR(1) job and the \fB-m\fR option was specified when the job was
submitted.
.sp
.LP
\fBcron\fR and \fBat\fR jobs are not executed if your account is locked. Jobs
and processses execute. The \fBshadow\fR(4) file defines which accounts are not
locked and will have their jobs and processes executed.
.SS "Setting cron Jobs Across Timezones"
.sp
.LP
The timezone of the \fBcron\fR daemon sets the system-wide timezone for
\fBcron\fR entries. This, in turn, is by set by default system-wide using
\fB/etc/default/init\fR. The timezone for \fBcron\fR entries can be overridden
in a user's crontab file; see \fBcrontab\fR(1).
.sp
.LP
If some form of \fBdaylight savings\fR or \fBsummer/winter time\fR is in
effect, then jobs scheduled during the switchover period could be executed
once, twice, or not at all.
.SS "Setting cron Defaults"
.sp
.LP
To keep a log of all actions taken by \fBcron\fR, you must specify
\fBCRONLOG=YES\fR in the \fB/etc/default/cron\fR file. If you specify
\fBCRONLOG=NO\fR, no logging is done. Keeping the log is a user configurable
option since \fBcron\fR usually creates huge log files.
.sp
.LP
You can specify the \fBPATH\fR for \fBuser\fR cron jobs by using
\fBPATH\fR\fB=\fR in \fB/etc/default/cron\fR. You can set the \fBPATH\fR for
\fBroot\fR cron jobs using \fBSU\fR\fBPATH\fR\fB=\fR in
\fB/etc/default/cron\fR. Carefully consider the security implications of
setting \fBPATH\fR and \fBSUPATH\fR.
.sp
.LP
Example \fB/etc/default/cron\fR file:
.sp
.in +2
.nf
CRONLOG=YES
PATH=/usr/bin:/usr/ucb:
.fi
.in -2
.sp

.sp
.LP
This example enables logging and sets the default \fBPATH\fR used by non-root
jobs to \fB/usr/bin:/usr/ucb:\fR. Root jobs continue to use
\fB/usr/sbin:/usr/bin\fR.
.sp
.LP
The \fBcron\fR log file is periodically rotated by \fBlogadm\fR(1M).
.SH FILES
.sp
.ne 2
.na
\fB\fB/etc/cron.d\fR\fR
.ad
.RS 25n
Main \fBcron\fR directory
.RE

.sp
.ne 2
.na
\fB\fB/etc/cron.d/FIFO\fR\fR
.ad
.RS 25n
Lock file
.RE

.sp
.ne 2
.na
\fB\fB/etc/default/cron\fR\fR
.ad
.RS 25n
\fBcron\fR default settings file
.RE

.sp
.ne 2
.na
\fB\fB/var/cron/log\fR\fR
.ad
.RS 25n
\fBcron\fR history information
.RE

.sp
.ne 2
.na
\fB\fB/var/spool/cron\fR\fR
.ad
.RS 25n
Spool area
.RE

.sp
.ne 2
.na
\fB\fB/etc/cron.d/queuedefs\fR\fR
.ad
.RS 25n
Queue description file for \fBat\fR, \fBbatch\fR, and \fBcron\fR
.RE

.sp
.ne 2
.na
\fB\fB/etc/logadm.conf\fR\fR
.ad
.RS 25n
Configuration file for \fBlogadm\fR
.RE

.SH SEE ALSO
.sp
.LP
\fBsvcs\fR(1), \fBat\fR(1), \fBcrontab\fR(1), \fBsh\fR(1), \fBlogadm\fR(1M),
\fBsvcadm\fR(1M), \fBqueuedefs\fR(4), \fBshadow\fR(4), \fBattributes\fR(5),
\fBrbac\fR(5), \fBsmf\fR(5), \fBsmf_security\fR(5)
.SH NOTES
.sp
.LP
The \fBcron\fR service is managed by the service management facility,
\fBsmf\fR(5), under the service identifier:
.sp
.in +2
.nf
svc:/system/cron:default
.fi
.in -2
.sp

.sp
.LP
Administrative actions on this service, such as enabling, disabling, or
requesting restart, can be performed using \fBsvcadm\fR(1M). The service's
status can be queried using the \fBsvcs\fR(1) command. Most administrative
actions may be delegated to users with the \fBsolaris.smf.manage.cron\fR
authorization (see \fBrbac\fR(5) and \fBsmf_security\fR(5)).
.SH DIAGNOSTICS
.sp
.LP
A history of all actions taken by \fBcron\fR is stored in \fB/var/cron/log\fR
and possibly in \fB/var/cron/olog\fR.