1 .\" Copyright (c) 1997 FreeBSD, Inc.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .Nd run periodic system functions
34 .Cm daily | weekly | monthly | security | Ar directory
40 utility is intended to be called by
42 to execute shell scripts
43 located in the specified directory.
45 One or more of the following arguments must be specified:
46 .Bl -tag -width "directory"
48 Perform the standard daily periodic executable run.
49 This usually occurs early in the morning (local time).
51 Perform the standard weekly periodic executable run.
52 This usually occurs very early on Saturday mornings.
54 Perform the standard monthly periodic executable run.
55 This usually occurs on the first day of the month.
57 Perform the standard daily security checks.
58 This is usually spawned by the
62 An arbitrary directory containing a set of executables to be run.
65 If an argument is an absolute directory name it is used as is, otherwise
66 it is searched for under
68 and any other directories specified by the
76 utility will run each executable file in the directory or directories
78 If a file does not have the executable bit set, it is silently ignored.
80 Each script is required to exit with one of the following values:
83 The script has produced nothing notable in its output.
85 .Ao Ar basedir Ac Ns Va _show_success
86 variable controls the masking of this output.
88 The script has produced some notable information in its output.
90 .Ao Ar basedir Ac Ns Va _show_info
91 variable controls the masking of this output.
93 The script has produced some warnings due to invalid configuration settings.
95 .Ao Ar basedir Ac Ns Va _show_badconfig
96 variable controls the masking of this output.
98 The script has produced output that must not be masked.
101 If the relevant variable (where
103 is the base directory in which the script resides) is set to
108 will mask the script output.
109 If the variable is not set to either
113 it will be given a default value as described in
114 .Xr periodic.conf 5 .
116 All remaining script output is delivered based on the value of the
117 .Ao Ar basedir Ac Ns Va _output
120 If this is set to a path name (beginning with a
122 character), output is simply logged to that file.
124 knows about the files
125 .Pa /var/log/daily.log , /var/log/weekly.log
127 .Pa /var/log/monthly.log ,
128 and if they exist, it will rotate them at the appropriate times.
129 These are therefore good values if you wish to log
134 .Ao Ar basedir Ac Ns Va _output
135 value does not begin with a
137 and is not empty, it is assumed to contain a list of email addresses, and
138 the output is mailed to them.
140 .Ao Ar basedir Ac Ns Va _show_empty_output
143 then no mail will be sent if the output was empty.
146 .Ao Ar basedir Ac Ns Va _output
147 is not set or is empty, output is sent to standard output.
153 environment to include all standard system directories, but no additional
156 If executables are added which depend upon other path components, each
157 executable must be responsible for configuring its own appropriate environment.
159 .Bl -tag -width ".Pa /etc/defaults/periodic.conf"
163 utility is typically called via entries in the system default
167 the top level directory containing
173 subdirectories which contain standard system periodic executables
174 .It Pa /etc/defaults/periodic.conf
177 system registry contains variables that control the behaviour of
180 .Pa daily , weekly , monthly ,
184 .It Pa /etc/periodic.conf , ${LOCALBASE}/etc/periodic.conf
185 this file contains local overrides for the default
190 Exit status is 0 on success and 1 if the command fails.
192 The system crontab should have entries for
194 similar to the following example:
195 .Bd -literal -offset indent
196 # do daily/weekly/monthly maintenance
197 0 2 * * * root periodic daily
198 0 3 * * 6 root periodic weekly
199 0 5 1 * * root periodic monthly
203 .Pa /etc/defaults/periodic.conf
204 system registry will typically have a
208 .Dl local_periodic="${_localbase}/etc/periodic"
212 is being set from within
213 .Pa /usr/sbin/periodic .
217 output instead of receiving it as email, add the following lines to
218 .Pa /etc/periodic.conf :
219 .Bd -literal -offset indent
220 daily_output=/var/log/daily.log
221 weekly_output=/var/log/weekly.log
222 monthly_output=/var/log/monthly.log
225 To only see important information from daily periodic jobs, add the
227 .Pa /etc/periodic.conf :
228 .Bd -literal -offset indent
229 daily_show_success=NO
231 daily_show_badconfig=NO
234 The command may fail for one of the following reasons:
236 .It usage: periodic <directory of files to execute>
237 No directory path argument was passed to
239 to specify where the script fragments reside.
240 .It <directory> not found
246 .Xr periodic.conf 5 ,
252 utility first appeared in
255 .An Paul Traina Aq Mt pst@FreeBSD.org
256 .An Brian Somers Aq Mt brian@Awfulhak.org
258 Since one specifies information about a directory using shell
259 variables containing the string,
262 must only contain characters that are valid within a
264 variable name, alphanumerics and underscores, and the first character