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
25 .\" $FreeBSD: head/usr.sbin/periodic/periodic.8 300356 2016-05-21 02:14:11Z asomers $
32 .Nd run periodic system functions
39 utility is intended to be called by
41 to execute shell scripts
42 located in the specified directory.
44 One or more of the following arguments must be specified:
45 .Bl -tag -width ".Pa monthly"
47 Perform the standard daily periodic executable run.
48 This usually occurs early in the morning (local time).
50 Perform the standard weekly periodic executable run.
51 This usually occurs very early on Saturday mornings.
53 Perform the standard monthly periodic executable run.
54 This usually occurs on the first day of the month.
56 Perform the standard daily security checks.
57 This is usually spawned by the
61 An arbitrary directory containing a set of executables to be run.
64 If an argument is an absolute directory name it is used as is, otherwise
65 it is searched for under
67 and any other directories specified by the
75 utility will run each executable file in the directory or directories
77 If a file does not have the executable bit set, it is silently ignored.
79 Each script is required to exit with one of the following values:
82 The script has produced nothing notable in its output.
84 .Ao Ar basedir Ac Ns Va _show_success
85 variable controls the masking of this output.
87 The script has produced some notable information in its output.
89 .Ao Ar basedir Ac Ns Va _show_info
90 variable controls the masking of this output.
92 The script has produced some warnings due to invalid configuration settings.
94 .Ao Ar basedir Ac Ns Va _show_badconfig
95 variable controls the masking of this output.
97 The script has produced output that must not be masked.
100 If the relevant variable (where
102 is the base directory in which the script resides) is set to
107 will mask the script output.
108 If the variable is not set to either
112 it will be given a default value as described in
113 .Xr periodic.conf 5 .
115 All remaining script output is delivered based on the value of the
116 .Ao Ar basedir Ac Ns Va _output
119 If this is set to a path name (beginning with a
121 character), output is simply logged to that file.
123 knows about the files
124 .Pa /var/log/daily.log , /var/log/weekly.log
126 .Pa /var/log/monthly.log ,
127 and if they exist, it will rotate them at the appropriate times.
128 These are therefore good values if you wish to log
133 .Ao Ar basedir Ac Ns Va _output
134 value does not begin with a
136 and is not empty, it is assumed to contain a list of email addresses, and
137 the output is mailed to them.
139 .Ao Ar basedir Ac Ns Va _show_empty_output
142 then no mail will be sent if the output was empty.
145 .Ao Ar basedir Ac Ns Va _output
146 is not set or is empty, output is sent to standard output.
152 environment to include all standard system directories, but no additional
155 If executables are added which depend upon other path components, each
156 executable must be responsible for configuring its own appropriate environment.
158 .Bl -tag -width ".Pa /etc/defaults/periodic.conf"
162 utility is typically called via entries in the system default
166 the top level directory containing
172 subdirectories which contain standard system periodic executables
173 .It Pa /etc/defaults/periodic.conf
176 system registry contains variables that control the behaviour of
179 .Pa daily , weekly , monthly ,
183 .It Pa /etc/periodic.conf
184 this file contains local overrides for the default
189 Exit status is 0 on success and 1 if the command fails.
191 The system crontab should have entries for
193 similar to the following example:
194 .Bd -literal -offset indent
195 # do daily/weekly/monthly maintenance
196 0 2 * * * root periodic daily
197 0 3 * * 6 root periodic weekly
198 0 5 1 * * root periodic monthly
202 .Pa /etc/defaults/periodic.conf
203 system registry will typically have a
207 .Dl local_periodic="/usr/local/etc/periodic"
211 output instead of receiving it as email, add the following lines to
212 .Pa /etc/periodic.conf :
213 .Bd -literal -offset indent
214 daily_output=/var/log/daily.log
215 weekly_output=/var/log/weekly.log
216 monthly_output=/var/log/monthly.log
219 To only see important information from daily periodic jobs, add the
221 .Pa /etc/periodic.conf :
222 .Bd -literal -offset indent
223 daily_show_success=NO
225 daily_show_badconfig=NO
228 The command may fail for one of the following reasons:
230 .It usage: periodic <directory of files to execute>
231 No directory path argument was passed to
233 to specify where the script fragments reside.
234 .It <directory> not found
240 .Xr periodic.conf 5 ,
246 utility first appeared in
249 .An Paul Traina Aq Mt pst@FreeBSD.org
250 .An Brian Somers Aq Mt brian@Awfulhak.org
252 Since one specifies information about a directory using shell
253 variables containing the string,
256 must only contain characters that are valid within a
258 variable name, alphanumerics and underscores, and the first character