.\" $OpenBSD: daily.8,v 1.8 2007/05/31 19:19:59 jmc Exp $ .\" .\" Copyright (c) 2003 Jason McIntyre .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: May 31 2007 $ .Dt DAILY 8 .Os .Sh NAME .Nm daily , weekly , monthly .Nd periodic system maintenance .Sh SYNOPSIS .Nm /etc/daily .Nm /etc/weekly .Nm /etc/monthly .Sh DESCRIPTION The three files .Pa /etc/daily , .Pa /etc/weekly , and .Pa /etc/monthly are shell scripts run on a periodic basis by the clock daemon, .Xr cron 8 . They take care of some basic administrative tasks for the system. When FabBSD is used to control machinery, these scripts are also a convenient place to execute routine machine maintenance tasks (or to send the operator various reminders). .Pp These scripts should not be altered. Local additions should be made to the files .Pa /etc/daily.local , .Pa /etc/weekly.local , and .Pa /etc/monthly.local , which will be executed by .Pa /etc/daily , .Pa /etc/weekly , and .Pa /etc/monthly , respectively. The .Pa *.local files are executed first, which makes it convenient to do any necessary cleanup and backup before the script is run. .Ss /etc/daily This script is run daily. It currently does the following: .Bl -dash .It Runs the script .Pa /etc/daily.local , if it exists. .It Removes scratch and junk files from .Pa /tmp and .Pa /var/tmp . .It Checks for core dumps. .It Removes system messages older than 21 days for the .Xr msgs 1 utility. .It Creates a backup root file system which is updated daily. This only happens if the following conditions are met: .Bl -enum -offset indent .It The environment variable .Ev ROOTBACKUP must be set. For example, the following can be added to root's .Xr crontab 5 : .Pp .Dl ROOTBACKUP=1 .It The mount directory .Pa /altroot must exist, and there must be an .Pa /etc/fstab entry specifying .Sq xx for the mount options, e.g. .Pp .Dl /dev/wd0j /altroot ffs xx 0 0 .El .It Checks disk status. Reports on the amount of disk used/available via .Xr df 1 . .It Reports networking statistics via .Xr netstat 1 . .It If .Ev CHECKFILESYSTEMS is set to 1 in root's .Xr crontab 5 , runs .Xr fsck 8 with the no-write flag .Pq Fl n . .It Runs the system security check script, .Pa /etc/security . See .Xr security 8 for further details. .El .Ss /etc/weekly This script is run weekly. It currently does the following: .Bl -dash .It Runs the script .Pa /etc/weekly.local , if it exists. .It Rebuilds the .Xr whatis 1 database(s) via .Xr makewhatis 8 . .El .Ss /etc/monthly This script is run monthly. It currently does the following: .Bl -dash .It Runs the script .Pa /etc/monthly.local , if it exists. .El .Sh ENVIRONMENT .Bl -tag -width "CHECKFILESYSTEMS" -compact .It Ev CHECKFILESYSTEMS Determines whether to run .Xr fsck 8 with the no-write flag. .It Ev ROOTBACKUP Determines whether to make a backup of the root file system. .El .Sh FILES .Bl -tag -width "/var/cron/tabs/root" -compact .It Pa /etc/daily Daily maintenance script. .It Pa /etc/daily.local Site specific daily maintenance script. .It Pa /etc/weekly Weekly maintenance script. .It Pa /etc/weekly.local Site specific weekly maintenance script. .It Pa /etc/monthly Monthly maintenance script. .It Pa /etc/monthly.local Site specific monthly maintenance script. .It Pa /var/cron/tabs/root Root .Xr crontab 5 . .El .Sh SEE ALSO .Xr crontab 1 , .Xr df 1 , .Xr msgs 1 , .Xr netstat 1 , .Xr whatis 1 , .Xr cnc 3 , .Xr crontab 5 , .Xr cron 8 , .Xr fsck 8 , .Xr makewhatis 8 , .Xr security 8 .Sh HISTORY This manual page first appeared in .Ox 3.4 . .Sh CAVEATS If the host machine is not running 24/7, these scripts may never be run. Adjusting the time fields in the system .Xr crontab 5 may partially alleviate this problem. .Pp FabBSD executes CNC programs in real-time in the kernel. If a CNC program is continuously executing, these scripts might never be run. To work around the problem, it is recommended that PREEMPT directives are inserted in CNC programs, such that the cron process is given a chance to execute (see .Xr cnc 3 for details).