— periodic system maintenance
The three files /etc/daily
are shell scripts run on a periodic basis by
the clock daemon, cron(8)
. They take care of
some basic administrative tasks. Their output, if any, is mailed to root.
: The scripts are all run as part of root's
. However, it is strongly
suggested that the root mail account be an alias that forwards messages to a
real user or set of users. Otherwise, root's mail will simply accumulate in
until the partition holding it runs out of space.
for further details.
These scripts should not be altered. Local additions should be made to the files
, which will be executed by
, respectively. The *.local
files are executed first, which makes it convenient to do any necessary
cleanup and backup and to define any required shell variables before the
script is run.
This script is run daily. It currently does the following:
- Runs the script /etc/daily.local, if it
- Removes scratch and junk files from
- Purges accounting records from
/var/account, if they exist. See
- Creates a backup root file system which is updated daily.
This only happens if the following conditions are met:
- The environment variable
ROOTBACKUP must be set. For example, the
following can be added to /etc/daily.local:
- The mount directory /altroot must
exist, and there must be an /etc/fstab entry
specifying a configured disk device, the file system type
‘ffs’, and ‘xx’ for the mount options, e.g.
/dev/wd0j /altroot ffs xx 0
- Checks daemon status. Lists any daemons which are enabled
in rc.conf.local(8) but which
are not actually running.
- Checks disk status. Reports on the amount of disk
used/available via df(1). Reports on which
file systems need to be dumped via
- Reports networking statistics via
- Runs the calendar(1)
utility unless the environment variable
is set to 0 in /etc/daily.local or the host is a
CHECKFILESYSTEMS is set to 1 in
fsck(8) with the no-write flag
- If the file /etc/Distfile exists, runs
the rdist(1) utility.
- Runs the system
security(8) check script.
This script is run weekly. It currently does the following:
- Runs the script /etc/weekly.local, if it
- Rebuilds the locate(1)
database, if there is an existing
- Rebuilds the whatis(1)
database(s) via makewhatis(8).
LOGINACCOUNTING is set to 1 in
/etc/weekly.local and the
/var/log/wtmp file exists, show individual users' login
via the ac(8) utility.
This script is run monthly. It currently does the following:
- Runs the script /etc/monthly.local, if
The following variables can be set in /etc/daily.local
- If set to 0, do not run
- If set to 1, run fsck(8)
with the no-write flag.
- If set to 1, make a backup of the root file system.
- If set to 0, df(1),
netstat(1) are skipped. Consequently,
if none of the other commands produce any output, no mail will be sent to
The following variables can be set in /etc/weekly.local
- If set to 1, run ac(8) to
report login accounting.
- If set to a string containing at least one character (even
a blank), use that string as the arguments to
makewhatis(8). If unset or empty,
use the default argument -Q.
- Daily maintenance script.
- Site specific daily maintenance script.
- Weekly maintenance script.
- Site specific weekly maintenance script.
- Monthly maintenance script.
- Site specific monthly maintenance script.
- Root crontab(5).
scripts first appeared in
. This manual page first appeared in
If the host machine is not running 24/7, these scripts may never be run.
Adjusting the time fields in the system
may partially alleviate this
Be careful when adding local additions. Services such as “www” have
their own users, and should be run as such, not as root. It may be more
appropriate to create a separate
for such services.