6253 F_GETLK doesn't always return lock owner
[illumos-gate.git] / usr / src / man / man1m / cron.1m
blob840d48af8ec04a6a4a702a095f95009ca8b71d21
1 '\" te
2 .\"  Copyright 1989 AT&T Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH CRON 1M "Feb 4, 2009"
7 .SH NAME
8 cron \- clock daemon
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fB/usr/sbin/cron\fR
13 .fi
15 .SH DESCRIPTION
16 .sp
17 .LP
18 \fBcron\fR starts a process that executes commands at specified dates and
19 times.
20 .sp
21 .LP
22 You can specify regularly scheduled commands to \fBcron\fR according to
23 instructions found in \fBcrontab\fR files in the directory
24 \fB/var/spool/cron/crontabs\fR. Users can submit their own \fBcrontab\fR file
25 using the \fBcrontab\fR(1) command. Commands which are to be executed only once
26 can be submitted using the \fBat\fR(1) command.
27 .sp
28 .LP
29 \fBcron\fR only examines \fBcrontab\fR or \fBat\fR command files during its own
30 process initialization phase and when the \fBcrontab\fR or \fBat\fR command is
31 run. This reduces the overhead of checking for new or changed files at
32 regularly scheduled intervals.
33 .sp
34 .LP
35 As \fBcron\fR never exits, it should be executed only once. This is done
36 routinely by way of the \fBsvc:/system/cron:default\fR service. The file
37 \fB/etc/cron.d/FIFO\fR file is used as a lock file to prevent the execution of
38 more than one instance of \fBcron\fR.
39 .sp
40 .LP
41 \fBcron\fR captures the output of the job's \fBstdout\fR and \fBstderr\fR
42 streams, and, if it is not empty, mails the output to the user. If the job does
43 not produce output, no mail is sent to the user. An exception is if the job is
44 an \fBat\fR(1) job and the \fB-m\fR option was specified when the job was
45 submitted.
46 .sp
47 .LP
48 \fBcron\fR and \fBat\fR jobs are not executed if your account is locked. Jobs
49 and processses execute. The \fBshadow\fR(4) file defines which accounts are not
50 locked and will have their jobs and processes executed.
51 .SS "Setting cron Jobs Across Timezones"
52 .sp
53 .LP
54 The timezone of the \fBcron\fR daemon sets the system-wide timezone for
55 \fBcron\fR entries. This, in turn, is by set by default system-wide using
56 \fB/etc/default/init\fR. The timezone for \fBcron\fR entries can be overridden
57 in a user's crontab file; see \fBcrontab\fR(1).
58 .sp
59 .LP
60 If some form of \fBdaylight savings\fR or \fBsummer/winter time\fR is in
61 effect, then jobs scheduled during the switchover period could be executed
62 once, twice, or not at all.
63 .SS "Setting cron Defaults"
64 .sp
65 .LP
66 To keep a log of all actions taken by \fBcron\fR, you must specify
67 \fBCRONLOG=YES\fR in the \fB/etc/default/cron\fR file. If you specify
68 \fBCRONLOG=NO\fR, no logging is done. Keeping the log is a user configurable
69 option since \fBcron\fR usually creates huge log files.
70 .sp
71 .LP
72 You can specify the \fBPATH\fR for \fBuser\fR cron jobs by using
73 \fBPATH\fR\fB=\fR in \fB/etc/default/cron\fR. You can set the \fBPATH\fR for
74 \fBroot\fR cron jobs using \fBSU\fR\fBPATH\fR\fB=\fR in
75 \fB/etc/default/cron\fR. Carefully consider the security implications of
76 setting \fBPATH\fR and \fBSUPATH\fR.
77 .sp
78 .LP
79 Example \fB/etc/default/cron\fR file:
80 .sp
81 .in +2
82 .nf
83 CRONLOG=YES
84 PATH=/usr/bin:/usr/ucb:
85 .fi
86 .in -2
87 .sp
89 .sp
90 .LP
91 This example enables logging and sets the default \fBPATH\fR used by non-root
92 jobs to \fB/usr/bin:/usr/ucb:\fR. Root jobs continue to use
93 \fB/usr/sbin:/usr/bin\fR.
94 .sp
95 .LP
96 The \fBcron\fR log file is periodically rotated by \fBlogadm\fR(1M).
97 .SH FILES
98 .sp
99 .ne 2
101 \fB\fB/etc/cron.d\fR\fR
103 .RS 25n
104 Main \fBcron\fR directory
108 .ne 2
110 \fB\fB/etc/cron.d/FIFO\fR\fR
112 .RS 25n
113 Lock file
117 .ne 2
119 \fB\fB/etc/default/cron\fR\fR
121 .RS 25n
122 \fBcron\fR default settings file
126 .ne 2
128 \fB\fB/var/cron/log\fR\fR
130 .RS 25n
131 \fBcron\fR history information
135 .ne 2
137 \fB\fB/var/spool/cron\fR\fR
139 .RS 25n
140 Spool area
144 .ne 2
146 \fB\fB/etc/cron.d/queuedefs\fR\fR
148 .RS 25n
149 Queue description file for \fBat\fR, \fBbatch\fR, and \fBcron\fR
153 .ne 2
155 \fB\fB/etc/logadm.conf\fR\fR
157 .RS 25n
158 Configuration file for \fBlogadm\fR
161 .SH SEE ALSO
164 \fBsvcs\fR(1), \fBat\fR(1), \fBcrontab\fR(1), \fBsh\fR(1), \fBlogadm\fR(1M),
165 \fBsvcadm\fR(1M), \fBqueuedefs\fR(4), \fBshadow\fR(4), \fBattributes\fR(5),
166 \fBrbac\fR(5), \fBsmf\fR(5), \fBsmf_security\fR(5)
167 .SH NOTES
170 The \fBcron\fR service is managed by the service management facility,
171 \fBsmf\fR(5), under the service identifier:
173 .in +2
175 svc:/system/cron:default
177 .in -2
182 Administrative actions on this service, such as enabling, disabling, or
183 requesting restart, can be performed using \fBsvcadm\fR(1M). The service's
184 status can be queried using the \fBsvcs\fR(1) command. Most administrative
185 actions may be delegated to users with the \fBsolaris.smf.manage.cron\fR
186 authorization (see \fBrbac\fR(5) and \fBsmf_security\fR(5)).
187 .SH DIAGNOSTICS
190 A history of all actions taken by \fBcron\fR is stored in \fB/var/cron/log\fR
191 and possibly in \fB/var/cron/olog\fR.