1997-08-12 17:48:49 +00:00
|
|
|
.\" Copyright (c) 1997 FreeBSD, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1999-08-28 01:35:59 +00:00
|
|
|
.\" $FreeBSD$
|
1997-08-12 17:48:49 +00:00
|
|
|
.\"
|
2007-09-07 21:54:45 +00:00
|
|
|
.Dd August 30, 2007
|
1997-08-13 16:27:59 +00:00
|
|
|
.Dt PERIODIC 8
|
2010-04-14 19:08:06 +00:00
|
|
|
.Os
|
1997-08-12 17:48:49 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm periodic
|
2001-04-18 15:54:10 +00:00
|
|
|
.Nd run periodic system functions
|
1997-08-12 17:48:49 +00:00
|
|
|
.Sh SYNOPSIS
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm
|
2001-11-20 12:38:18 +00:00
|
|
|
.Ar directory ...
|
1997-08-12 17:48:49 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
2002-07-14 14:47:15 +00:00
|
|
|
utility is intended to be called by
|
2001-08-08 11:48:28 +00:00
|
|
|
.Xr cron 8
|
|
|
|
to execute shell scripts
|
1997-08-12 17:48:49 +00:00
|
|
|
located in the specified directory.
|
|
|
|
.Pp
|
2000-09-14 17:19:15 +00:00
|
|
|
One or more of the following arguments must be specified:
|
2001-11-20 12:38:18 +00:00
|
|
|
.Bl -tag -width ".Pa monthly"
|
|
|
|
.It Pa daily
|
1997-08-13 06:02:18 +00:00
|
|
|
Perform the standard daily periodic executable run.
|
|
|
|
This usually occurs early in the morning (local time).
|
2001-11-20 12:38:18 +00:00
|
|
|
.It Pa weekly
|
1997-08-13 06:02:18 +00:00
|
|
|
Perform the standard weekly periodic executable run.
|
2007-09-07 21:54:45 +00:00
|
|
|
This usually occurs very early on Saturday mornings.
|
2001-11-20 12:38:18 +00:00
|
|
|
.It Pa monthly
|
1997-08-13 06:02:18 +00:00
|
|
|
Perform the standard monthly periodic executable run.
|
|
|
|
This usually occurs on the first day of the month.
|
2001-12-07 23:57:39 +00:00
|
|
|
.It Pa security
|
|
|
|
Perform the standard daily security checks.
|
|
|
|
This is usually spawned by the
|
|
|
|
.Pa daily
|
|
|
|
run.
|
1997-08-12 17:48:49 +00:00
|
|
|
.It Ar path
|
2000-09-14 17:19:15 +00:00
|
|
|
An arbitrary directory containing a set of executables to be run.
|
1997-08-12 17:48:49 +00:00
|
|
|
.El
|
1997-08-13 06:02:18 +00:00
|
|
|
.Pp
|
2000-09-14 17:19:15 +00:00
|
|
|
If an argument is an absolute directory name it is used as is, otherwise
|
|
|
|
it is searched for under
|
|
|
|
.Pa /etc/periodic
|
|
|
|
and any other directories specified by the
|
|
|
|
.Va local_periodic
|
|
|
|
setting in
|
|
|
|
.Xr periodic.conf 5
|
|
|
|
(see below).
|
|
|
|
.Pp
|
1997-08-13 06:02:18 +00:00
|
|
|
The
|
|
|
|
.Nm
|
2002-07-14 14:47:15 +00:00
|
|
|
utility will run each executable file in the directory or directories
|
2000-09-14 17:19:15 +00:00
|
|
|
specified.
|
2001-11-20 12:38:18 +00:00
|
|
|
If a file does not have the executable bit set, it is silently ignored.
|
2000-09-14 17:19:15 +00:00
|
|
|
.Pp
|
|
|
|
Each script is required to exit with one of the following values:
|
2001-11-20 12:38:18 +00:00
|
|
|
.Bl -tag -width 4n
|
2000-09-14 17:19:15 +00:00
|
|
|
.It 0
|
2001-04-15 19:53:47 +00:00
|
|
|
The script has produced nothing notable in its output.
|
2000-09-14 17:19:15 +00:00
|
|
|
The
|
2001-11-20 12:38:18 +00:00
|
|
|
.Ao Ar basedir Ac Ns Va _show_success
|
2000-09-14 17:19:15 +00:00
|
|
|
variable controls the masking of this output.
|
|
|
|
.It 1
|
2001-04-15 19:53:47 +00:00
|
|
|
The script has produced some notable information in its output.
|
2000-09-14 17:19:15 +00:00
|
|
|
The
|
2001-11-20 12:38:18 +00:00
|
|
|
.Ao Ar basedir Ac Ns Va _show_info
|
2000-09-14 17:19:15 +00:00
|
|
|
variable controls the masking of this output.
|
|
|
|
.It 2
|
|
|
|
The script has produced some warnings due to invalid configuration settings.
|
|
|
|
The
|
2001-11-20 12:38:18 +00:00
|
|
|
.Ao Ar basedir Ac Ns Va _show_badconfig
|
2000-09-14 17:19:15 +00:00
|
|
|
variable controls the masking of this output.
|
|
|
|
.It >2
|
|
|
|
The script has produced output that must not be masked.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
If the relevant variable (where
|
2001-11-20 12:38:18 +00:00
|
|
|
.Aq Ar basedir
|
2000-09-14 17:19:15 +00:00
|
|
|
is the base directory in which the script resides) is set to
|
2001-11-20 12:38:18 +00:00
|
|
|
.Dq Li NO
|
2000-09-14 17:19:15 +00:00
|
|
|
in
|
|
|
|
.Pa periodic.conf ,
|
|
|
|
.Nm
|
|
|
|
will mask the script output.
|
|
|
|
If the variable is not set to either
|
2001-11-20 12:38:18 +00:00
|
|
|
.Dq Li YES
|
2000-09-14 17:19:15 +00:00
|
|
|
or
|
2001-11-20 12:38:18 +00:00
|
|
|
.Dq Li NO ,
|
2000-09-14 17:19:15 +00:00
|
|
|
it will be given a default value as described in
|
|
|
|
.Xr periodic.conf 5 .
|
|
|
|
.Pp
|
|
|
|
All remaining script output is delivered based on the value of the
|
2001-11-20 12:38:18 +00:00
|
|
|
.Ao Ar basedir Ac Ns Va _output
|
2000-09-14 17:19:15 +00:00
|
|
|
setting.
|
|
|
|
.Pp
|
2001-07-15 08:06:20 +00:00
|
|
|
If this is set to a path name (beginning with a
|
2001-11-20 12:38:18 +00:00
|
|
|
.Ql /
|
|
|
|
character), output is simply logged to that file.
|
2000-09-14 17:19:15 +00:00
|
|
|
.Xr newsyslog 8
|
|
|
|
knows about the files
|
2001-11-20 12:38:18 +00:00
|
|
|
.Pa /var/log/daily.log , /var/log/weekly.log
|
2000-09-14 17:19:15 +00:00
|
|
|
and
|
|
|
|
.Pa /var/log/monthly.log ,
|
|
|
|
and if they exist, it will rotate them at the appropriate times.
|
|
|
|
These are therefore good values if you wish to log
|
|
|
|
.Nm
|
|
|
|
output.
|
|
|
|
.Pp
|
|
|
|
If the
|
2001-11-20 12:38:18 +00:00
|
|
|
.Ao Ar basedir Ac Ns Va _output
|
2000-09-14 17:19:15 +00:00
|
|
|
value does not begin with a
|
2001-11-20 12:38:18 +00:00
|
|
|
.Ql /
|
2000-09-19 22:15:00 +00:00
|
|
|
and is not empty, it is assumed to contain a list of email addresses, and
|
|
|
|
the output is mailed to them.
|
2007-06-22 10:04:05 +00:00
|
|
|
If
|
|
|
|
.Ao Ar basedir Ac Ns Va _show_empty_output
|
|
|
|
is set to
|
|
|
|
.Dq Li NO ,
|
|
|
|
then no mail will be sent if the output was empty.
|
2000-09-14 17:19:15 +00:00
|
|
|
.Pp
|
|
|
|
If
|
2001-11-20 12:38:18 +00:00
|
|
|
.Ao Ar basedir Ac Ns Va _output
|
2000-09-19 22:15:00 +00:00
|
|
|
is not set or is empty, output is sent to standard output.
|
1997-08-12 17:48:49 +00:00
|
|
|
.Sh ENVIRONMENT
|
2001-07-15 08:06:20 +00:00
|
|
|
The
|
1997-08-12 17:48:49 +00:00
|
|
|
.Nm
|
2002-07-14 14:47:15 +00:00
|
|
|
utility sets the
|
1997-08-12 17:48:49 +00:00
|
|
|
.Ev PATH
|
1997-08-13 06:02:18 +00:00
|
|
|
environment to include all standard system directories, but no additional
|
|
|
|
directories, such as
|
|
|
|
.Pa /usr/local/bin .
|
|
|
|
If executables are added which depend upon other path components, each
|
|
|
|
executable must be responsible for configuring its own appropriate environment.
|
1997-08-12 17:48:49 +00:00
|
|
|
.Sh FILES
|
2002-07-14 14:47:15 +00:00
|
|
|
.Bl -tag -width ".Pa /etc/defaults/periodic.conf"
|
1997-08-12 17:48:49 +00:00
|
|
|
.It Pa /etc/crontab
|
2002-07-14 14:47:15 +00:00
|
|
|
the
|
1997-08-12 17:48:49 +00:00
|
|
|
.Nm
|
2002-07-14 14:47:15 +00:00
|
|
|
utility is typically called via entries in the system default
|
2001-11-20 12:38:18 +00:00
|
|
|
.Xr cron 8
|
2002-07-14 14:47:15 +00:00
|
|
|
table
|
1997-08-16 17:08:35 +00:00
|
|
|
.It Pa /etc/periodic
|
2002-07-14 14:47:15 +00:00
|
|
|
the top level directory containing
|
1997-08-13 06:02:18 +00:00
|
|
|
.Pa daily ,
|
|
|
|
.Pa weekly ,
|
|
|
|
and
|
|
|
|
.Pa monthly
|
2002-07-14 14:47:15 +00:00
|
|
|
subdirectories which contain standard system periodic executables
|
2000-06-23 01:18:31 +00:00
|
|
|
.It Pa /etc/defaults/periodic.conf
|
2002-07-14 14:47:15 +00:00
|
|
|
the
|
2000-06-23 01:18:31 +00:00
|
|
|
.Pa periodic.conf
|
2000-09-14 17:19:15 +00:00
|
|
|
system registry contains variables that control the behaviour of
|
|
|
|
.Nm
|
|
|
|
and the standard
|
2001-11-20 12:38:18 +00:00
|
|
|
.Pa daily , weekly ,
|
1997-08-13 06:02:18 +00:00
|
|
|
and
|
2000-09-14 17:19:15 +00:00
|
|
|
.Pa monthly
|
2002-07-14 14:47:15 +00:00
|
|
|
scripts
|
2000-09-14 17:19:15 +00:00
|
|
|
.It Pa /etc/periodic.conf
|
2002-07-14 14:47:15 +00:00
|
|
|
this file contains local overrides for the default
|
2001-11-20 12:38:18 +00:00
|
|
|
.Nm
|
2002-07-14 14:47:15 +00:00
|
|
|
configuration
|
1997-08-12 17:48:49 +00:00
|
|
|
.El
|
2005-01-18 20:02:45 +00:00
|
|
|
.Sh EXIT STATUS
|
|
|
|
Exit status is 0 on success and 1 if the command fails.
|
1997-08-12 17:48:49 +00:00
|
|
|
.Sh EXAMPLES
|
|
|
|
The system crontab should have entries for
|
|
|
|
.Nm
|
|
|
|
similar to the following example:
|
2001-11-20 12:38:18 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
# do daily/weekly/monthly maintenance
|
|
|
|
0 2 * * * root periodic daily
|
|
|
|
0 3 * * 6 root periodic weekly
|
|
|
|
0 5 1 * * root periodic monthly
|
|
|
|
.Ed
|
1997-08-13 06:02:18 +00:00
|
|
|
.Pp
|
2000-09-14 17:19:15 +00:00
|
|
|
The
|
2000-06-23 01:18:31 +00:00
|
|
|
.Pa /etc/defaults/periodic.conf
|
|
|
|
system registry will typically have a
|
1999-04-23 18:26:55 +00:00
|
|
|
.Va local_periodic
|
1997-08-13 06:02:18 +00:00
|
|
|
variable reading:
|
2000-06-23 01:18:31 +00:00
|
|
|
.Pp
|
2007-07-24 06:41:07 +00:00
|
|
|
.Dl local_periodic="/usr/local/etc/periodic"
|
2000-09-14 17:19:15 +00:00
|
|
|
.Pp
|
|
|
|
To log
|
|
|
|
.Nm
|
|
|
|
output instead of receiving it as email, add the following lines to
|
|
|
|
.Pa /etc/periodic.conf :
|
2001-11-20 12:38:18 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
daily_output=/var/log/daily.log
|
|
|
|
weekly_output=/var/log/weekly.log
|
|
|
|
monthly_output=/var/log/monthly.log
|
|
|
|
.Ed
|
2000-09-14 17:19:15 +00:00
|
|
|
.Pp
|
|
|
|
To only see important information from daily periodic jobs, add the
|
|
|
|
following lines to
|
|
|
|
.Pa /etc/periodic.conf :
|
2001-11-20 12:38:18 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
daily_show_success=NO
|
|
|
|
daily_show_info=NO
|
|
|
|
daily_show_badconfig=NO
|
|
|
|
.Ed
|
1997-08-12 17:48:49 +00:00
|
|
|
.Sh DIAGNOSTICS
|
2005-01-17 07:44:44 +00:00
|
|
|
The command may fail for one of the following reasons:
|
1997-08-12 17:48:49 +00:00
|
|
|
.Bl -diag
|
|
|
|
.It usage: periodic <directory of files to execute>
|
|
|
|
No directory path argument was passed to
|
|
|
|
.Nm
|
|
|
|
to specify where the script fragments reside.
|
|
|
|
.It <directory> not found
|
|
|
|
Self explanatory.
|
|
|
|
.El
|
2005-01-18 20:02:45 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr sh 1 ,
|
|
|
|
.Xr crontab 5 ,
|
|
|
|
.Xr periodic.conf 5 ,
|
|
|
|
.Xr cron 8 ,
|
|
|
|
.Xr newsyslog 8
|
1997-08-12 17:48:49 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
2002-07-14 14:47:15 +00:00
|
|
|
utility first appeared in
|
1997-08-12 17:48:49 +00:00
|
|
|
.Fx 3.0 .
|
2005-01-18 20:02:45 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
.An Paul Traina Aq pst@FreeBSD.org
|
|
|
|
.An Brian Somers Aq brian@Awfulhak.org
|
2001-11-28 21:43:53 +00:00
|
|
|
.Sh BUGS
|
|
|
|
Since one specifies information about a directory using shell
|
|
|
|
variables containing the string,
|
2001-12-08 16:15:44 +00:00
|
|
|
.Aq Ar basedir ,
|
|
|
|
.Aq Ar basedir
|
2001-11-28 21:43:53 +00:00
|
|
|
must only contain characters that are valid within a
|
|
|
|
.Xr sh 1
|
|
|
|
variable name, alphanumerics and underscores, and the first character
|
|
|
|
may not be numeric.
|