Merge commit 'dc97a43d4a70c8773a619f11b95b07a787f6f5b7' into merges
[unleashed.git] / share / man / man8 / cron.8
blobd005af0ece1645a1e9adc81895ab7ce623a6320e
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 8 "Mar 30, 2017"
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 .LP
17 \fBcron\fR starts a process that executes commands at specified dates and
18 times.
19 .sp
20 .LP
21 You can specify regularly scheduled commands to \fBcron\fR according to
22 instructions found in \fBcrontab\fR files in the directory
23 \fB/var/spool/cron/crontabs\fR. Users can submit their own \fBcrontab\fR file
24 using the \fBcrontab\fR(1) command. Commands which are to be executed only once
25 can be submitted using the \fBat\fR(1) command.
26 .sp
27 .LP
28 \fBcron\fR only examines \fBcrontab\fR or \fBat\fR command files during its own
29 process initialization phase and when the \fBcrontab\fR or \fBat\fR command is
30 run. This reduces the overhead of checking for new or changed files at
31 regularly scheduled intervals.
32 .sp
33 .LP
34 As \fBcron\fR never exits, it should be executed only once. This is done
35 routinely by way of the \fBsvc:/system/cron:default\fR service. The file
36 \fB/etc/cron.d/FIFO\fR file is used as a lock file to prevent the execution of
37 more than one instance of \fBcron\fR.
38 .sp
39 .LP
40 \fBcron\fR captures the output of the job's \fBstdout\fR and \fBstderr\fR
41 streams, and, if it is not empty, mails the output to the user. If the job does
42 not produce output, no mail is sent to the user. An exception is if the job is
43 an \fBat\fR(1) job and the \fB-m\fR option was specified when the job was
44 submitted.
45 .sp
46 .LP
47 \fBcron\fR and \fBat\fR jobs are not executed if your account is locked.
48 The \fBshadow\fR(4) file defines which accounts are not
49 locked and will have their jobs executed.
50 .SS "Setting cron Jobs Across Timezones"
51 .LP
52 The timezone of the \fBcron\fR daemon sets the system-wide timezone for
53 \fBcron\fR entries. This, in turn, is by set by default system-wide using
54 \fB/etc/default/init\fR. The timezone for \fBcron\fR entries can be overridden
55 in a user's crontab file; see \fBcrontab\fR(1).
56 .sp
57 .LP
58 If some form of \fBdaylight savings\fR or \fBsummer/winter time\fR is in
59 effect, then jobs scheduled during the switchover period could be executed
60 once, twice, or not at all.
61 .SS "Setting cron Defaults"
62 .LP
63 To keep a log of all actions taken by \fBcron\fR, you must specify
64 \fBCRONLOG=YES\fR in the \fB/etc/default/cron\fR file. If you specify
65 \fBCRONLOG=NO\fR, no logging is done. Keeping the log is a user configurable
66 option since \fBcron\fR usually creates huge log files.
67 .sp
68 .LP
69 You can specify the \fBPATH\fR for \fBuser\fR cron jobs by using
70 \fBPATH\fR\fB=\fR in \fB/etc/default/cron\fR. You can set the \fBPATH\fR for
71 \fBroot\fR cron jobs using \fBSU\fR\fBPATH\fR\fB=\fR in
72 \fB/etc/default/cron\fR. Carefully consider the security implications of
73 setting \fBPATH\fR and \fBSUPATH\fR.
74 .sp
75 .LP
76 Example \fB/etc/default/cron\fR file:
77 .sp
78 .in +2
79 .nf
80 CRONLOG=YES
81 PATH=/usr/bin:/usr/sbin
82 .fi
83 .in -2
84 .sp
86 .sp
87 .LP
88 This example enables logging and sets the default \fBPATH\fR used by non-root
89 jobs to \fB/usr/bin:/usr/sbin\fR. Root jobs continue to use
90 \fB/usr/sbin:/usr/bin\fR.
91 .sp
92 .LP
93 The \fBcron\fR log file is periodically rotated by \fBlogadm\fR(8).
94 .SH FILES
95 .ne 2
96 .na
97 \fB\fB/etc/cron.d\fR\fR
98 .ad
99 .RS 25n
100 Main \fBcron\fR directory
104 .ne 2
106 \fB\fB/etc/cron.d/FIFO\fR\fR
108 .RS 25n
109 Lock file
113 .ne 2
115 \fB\fB/etc/default/cron\fR\fR
117 .RS 25n
118 \fBcron\fR default settings file
122 .ne 2
124 \fB\fB/var/cron/log\fR\fR
126 .RS 25n
127 \fBcron\fR history information
131 .ne 2
133 \fB\fB/var/spool/cron\fR\fR
135 .RS 25n
136 Spool area
140 .ne 2
142 \fB\fB/etc/cron.d/queuedefs\fR\fR
144 .RS 25n
145 Queue description file for \fBat\fR, \fBbatch\fR, and \fBcron\fR
149 .ne 2
151 \fB\fB/etc/logadm.conf\fR\fR
153 .RS 25n
154 Configuration file for \fBlogadm\fR
157 .SH SEE ALSO
159 \fBsvcs\fR(1), \fBat\fR(1), \fBcrontab\fR(1), \fBsh\fR(1), \fBlogadm\fR(8),
160 \fBsvcadm\fR(8), \fBqueuedefs\fR(4), \fBshadow\fR(4), \fBattributes\fR(5),
161 \fBrbac\fR(5), \fBsmf\fR(5), \fBsmf_security\fR(5)
162 .SH NOTES
164 The \fBcron\fR service is managed by the service management facility,
165 \fBsmf\fR(5), under the service identifier:
167 .in +2
169 svc:/system/cron:default
171 .in -2
176 Administrative actions on this service, such as enabling, disabling, or
177 requesting restart, can be performed using \fBsvcadm\fR(8). The service's
178 status can be queried using the \fBsvcs\fR(1) command. Most administrative
179 actions may be delegated to users with the \fBsolaris.smf.manage.cron\fR
180 authorization (see \fBrbac\fR(5) and \fBsmf_security\fR(5)).
181 .SH DIAGNOSTICS
183 A history of all actions taken by \fBcron\fR is stored in \fB/var/cron/log\fR
184 and possibly in \fB/var/cron/olog\fR.