summaryrefslogtreecommitdiff
path: root/usr/src/man/man1m/cron.1m
blob: 3abeda24ba1cee13ed352aa25a4e7a4e817f2dd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
'\" 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 "Mar 30, 2017"
.SH NAME
cron \- clock daemon
.SH SYNOPSIS
.LP
.nf
\fB/usr/sbin/cron\fR
.fi

.SH DESCRIPTION
.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.
The \fBshadow\fR(4) file defines which accounts are not
locked and will have their jobs executed.
.SS "Setting cron Jobs Across Timezones"
.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"
.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
.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
.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
.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
.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.