summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-06-23 01:18:31 +0000
committerbrian <brian@FreeBSD.org>2000-06-23 01:18:31 +0000
commit567e3fdcca0faa8172592279ac0456abbbcefc73 (patch)
tree77123bc5d54c8b955e70336abe11b0e381d8a9cb
parent5c86744d35958722a77ae5346e0c2ee161efd003 (diff)
downloadFreeBSD-src-567e3fdcca0faa8172592279ac0456abbbcefc73.zip
FreeBSD-src-567e3fdcca0faa8172592279ac0456abbbcefc73.tar.gz
Introduce /etc/defaults/periodic.conf, similar in concept to rc.conf.
The only change in the default functionality should be that the output reports are slightly more verbose WRT files deleted. Not objected to by: freebsd-arch
-rw-r--r--etc/Makefile3
-rw-r--r--etc/defaults/periodic.conf166
-rw-r--r--etc/defaults/rc.conf10
-rwxr-xr-xetc/periodic/daily/100.clean-disks36
-rwxr-xr-xetc/periodic/daily/110.clean-tmps29
-rwxr-xr-xetc/periodic/daily/120.clean-preserve33
-rwxr-xr-xetc/periodic/daily/130.clean-msgs25
-rwxr-xr-xetc/periodic/daily/140.clean-rwho31
-rwxr-xr-xetc/periodic/daily/150.clean-hoststat33
-rwxr-xr-xetc/periodic/daily/200.backup-passwd90
-rwxr-xr-xetc/periodic/daily/210.backup-aliases45
-rwxr-xr-xetc/periodic/daily/220.backup-distfile32
-rwxr-xr-xetc/periodic/daily/300.calendar22
-rwxr-xr-xetc/periodic/daily/310.accounting32
-rwxr-xr-xetc/periodic/daily/320.rdist22
-rwxr-xr-xetc/periodic/daily/330.news19
-rwxr-xr-xetc/periodic/daily/340.uucp20
-rwxr-xr-xetc/periodic/daily/400.status-disks23
-rwxr-xr-xetc/periodic/daily/410.status-uucp22
-rwxr-xr-xetc/periodic/daily/420.status-network27
-rwxr-xr-xetc/periodic/daily/430.status-rwho28
-rwxr-xr-xetc/periodic/daily/440.status-mailq37
-rwxr-xr-xetc/periodic/daily/450.status-security42
-rwxr-xr-xetc/periodic/daily/460.status-mail-rejects30
-rwxr-xr-xetc/periodic/daily/999.local24
-rwxr-xr-xetc/periodic/monthly/200.accounting25
-rwxr-xr-xetc/periodic/monthly/999.local24
-rwxr-xr-xetc/periodic/weekly/120.clean-kvmdb34
-rwxr-xr-xetc/periodic/weekly/300.uucp22
-rwxr-xr-xetc/periodic/weekly/310.locate32
-rwxr-xr-xetc/periodic/weekly/320.whatis56
-rwxr-xr-xetc/periodic/weekly/330.catman62
-rw-r--r--etc/periodic/weekly/340.noid23
-rwxr-xr-xetc/periodic/weekly/999.local25
-rw-r--r--share/man/man5/Makefile5
-rw-r--r--share/man/man5/periodic.conf.5416
-rw-r--r--share/man/man5/rc.conf.527
-rw-r--r--usr.sbin/periodic/periodic.813
-rw-r--r--usr.sbin/periodic/periodic.sh8
39 files changed, 1333 insertions, 320 deletions
diff --git a/etc/Makefile b/etc/Makefile
index d3626c0..742c76b 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -63,6 +63,7 @@ distribution:
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 defaults/rc.conf ${DESTDIR}/etc/defaults/; \
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 defaults/make.conf ${DESTDIR}/etc/defaults/; \
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 defaults/pccard.conf ${DESTDIR}/etc/defaults/; \
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 defaults/periodic.conf ${DESTDIR}/etc/defaults/; \
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
${DESTDIR}/var/log/cron; \
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 \
@@ -178,6 +179,8 @@ etc-examples:
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 defaults/make.conf \
${DESTDIR}/usr/share/examples/etc/defaults; \
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 defaults/pccard.conf \
+ ${DESTDIR}/usr/share/examples/etc/defaults); \
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 defaults/periodic.conf \
${DESTDIR}/usr/share/examples/etc/defaults)
.include <bsd.prog.mk>
diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf
new file mode 100644
index 0000000..68a18cf
--- /dev/null
+++ b/etc/defaults/periodic.conf
@@ -0,0 +1,166 @@
+#!/bin/sh
+#
+# This is defaults/periodic.conf - a file full of useful variables that
+# you can set to change the default behaviour of periodic jobs on your
+# system. You should not edit this file! Put any overrides into one of the
+# $periodic_conf_files instead and you will be able to update these defaults
+# later without spamming your local configuration information.
+#
+# The $periodic_conf_files files should only contain values which override
+# values set in this file. This eases the upgrade path when defaults
+# are changed and new features are added.
+#
+# $FreeBSD$
+#
+
+# What files override these defaults ?
+periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local"
+
+# periodic script dirs
+local_periodic="/usr/local/etc/periodic /usr/X11R6/etc/periodic"
+
+
+# Daily options
+
+# 100.clean-disks
+daily_clean_disks_enable="NO" # Delete files daily
+daily_clean_disks_files="[#,]* .#* a.out *.core *.CKP .emacs_[0-9]*"
+daily_clean_disks_days=3 # If older than this
+daily_clean_disks_verbose="YES" # Mention files deleted
+
+# 110.clean-tmps
+daily_clean_tmps_enable="NO" # Delete stuff daily
+daily_clean_tmps_dirs="/tmp" # Delete under here
+daily_clean_tmps_days="3" # If not accessed for
+daily_clean_tmps_ignore=".X*-lock quota.user quota.group" # Don't delete these
+daily_clean_tmps_verbose="YES" # Mention files deleted
+
+# 120.clean-preserve
+daily_clean_preserve_enable="YES" # Delete files daily
+daily_clean_preserve_days=7 # If not modified for
+daily_clean_preserve_verbose="YES" # Mention files deleted
+
+# 130.clean-msgs
+daily_clean_msgs_enable="YES" # Delete msgs daily
+daily_clean_msgs_days= # If not modified for
+
+# 140.clean-rwho
+daily_clean_rwho_enable="YES" # Delete rwho daily
+daily_clean_rwho_days=7 # If not modified for
+daily_clean_rwho_verbose="YES" # Mention files deleted
+
+# 150.clean-hoststat
+daily_clean_hoststat_enable="YES" # Delete .hoststat daily
+daily_clean_hoststat_days=3 # If not modified for
+daily_clean_hoststat_verbose="YES" # Mention files deleted
+
+# 200.backup-passwd
+daily_backup_passwd_enable="YES" # Backup passwd & group
+
+# 210.backup-aliases
+daily_backup_aliases_enable="YES" # Backup mail aliases
+
+# 220.backup-distfile
+daily_backup_distfile_enable="YES" # Backup distfile
+
+# 300.calendar
+daily_calendar_enable="NO" # Run calendar -a
+
+# 310.accounting
+daily_accounting_enable="YES" # Rotate acct files
+
+# 320.distfile
+daily_distfile_enable="YES" # Run rdist daily
+
+# 330.news
+daily_news_expire_enable="YES" # Run news.expire
+
+# 340.uucp
+daily_uuclean_enable="YES" # Run uuclean.daily
+
+# 400.status-disks
+daily_status_disks_enable="YES" # Check disk status
+
+# 410.status-uucp
+daily_status_uucp_enable="YES" # Check uucp status
+
+# 420.status-network
+daily_status_network_enable="YES" # Check network status
+daily_status_network_usedns="YES" # DNS lookups are ok
+
+# 430.status-rwho
+daily_status_rwho_enable="YES" # Check system status
+
+# 440.status-mailq
+daily_status_mailq_enable="YES" # Check mail status
+daily_status_mailq_shorten="NO" # Shorten output
+
+# 450.status-security
+daily_status_security_enable="YES" # Security check
+daily_status_security_inline="NO" # Run inline ?
+daily_status_security_noamd="NO" # Don't check amd mounts
+daily_status_security_nomfs="NO" # Don't check mfs mounts
+
+# 460.status-mail-rejects
+daily_status_mail_rejects_enable="YES" # Check mail rejects
+
+# 999.local
+daily_local="/etc/daily.local" # Local scripts
+
+
+# Weekly options
+
+# 120.clean-kvmdb
+weekly_clean_kvmdb_enable="YES" # Clean kvmdb weekly
+weekly_clean_kvmdb_days=7 # If not accessed for
+weekly_clean_kvmdb_verbose="YES" # Mention files deleted
+
+# 300.uucp
+weekly_uucp_enable="YES" # Clean uucp weekly
+
+# 310.locate
+weekly_locate_enable="YES" # Update locate weekly
+
+# 320.whatis
+weekly_whatis_enable="YES" # Update whatis weekly
+
+# 330.catman
+weekly_catman_enable="NO" # Preformat man pages
+
+# 340.noid
+weekly_noid_enable="NO" # Find unowned files
+weekly_noid_dirs="/" # Look here
+
+# 999.local
+weekly_local="/etc/weekly.local" # Local scripts
+
+
+# Monthly options
+
+# 200.accounting
+monthly_accounting_enable="YES" # Login accounting
+
+# 999.local
+monthly_local="/etc/monthly.local" # Local scripts
+
+
+# Define source_periodic_confs, the mechanism used by /etc/periodic/*/*
+# scripts to source defaults/periodic.conf overrides safely.
+
+if [ -z "${source_periodic_confs_defined}" ]; then
+ source_periodic_confs_defined=yes
+ source_periodic_confs () {
+ local i sourced_files
+
+ for i in ${periodic_conf_files}; do
+ case ${sourced_files} in
+ *:$i:*)
+ ;;
+ *)
+ sourced_files="${sourced_files}:$i:"
+ [ -r $i ] && . $i
+ ;;
+ esac
+ done
+ }
+fi
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index ff8f45b..8563a0e 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -30,7 +30,6 @@ pccard_ifconfig="NO" # Specialized pccard ethernet configuration (or NO).
pccardd_flags="" # Additional flags for pccardd.
pccard_conf="/etc/defaults/pccard.conf" # pccardd(8) config file
local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs.
-local_periodic="/usr/local/etc/periodic /usr/X11R6/etc/periodic" # periodic script dirs
rc_conf_files="/etc/rc.conf /etc/rc.conf.local"
##############################################################
@@ -295,15 +294,6 @@ update_motd="YES" # update version info in /etc/motd (or NO)
start_vinum="" # set to YES to start vinum
##############################################################
-### /etc/periodic options ###################################
-##############################################################
-clear_daily_enable="NO" # Delete stuff daily
-clear_daily_dirs="/tmp" # Delete under here
-clear_daily_days="3" # If older than this
-clear_daily_ignore=".X*-lock quota.user quota.group" # Don't delete these
-clear_daily_verbose="YES" # Mention files deleted
-
-##############################################################
### Define source_rc_confs, the mechanism used by /etc/rc.* ##
### scripts to source rc_conf_files overrides safely. ##
##############################################################
diff --git a/etc/periodic/daily/100.clean-disks b/etc/periodic/daily/100.clean-disks
index e6b744a..2efe3b5 100755
--- a/etc/periodic/daily/100.clean-disks
+++ b/etc/periodic/daily/100.clean-disks
@@ -2,10 +2,36 @@
#
# $FreeBSD$
#
+# Remove garbage files more than $daily_clean_disks_days days old
+#
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
+
+case "$daily_clean_disks_enable" in
+ [Yy][Ee][Ss])
+ if [ -n "$daily_clean_disks_days" -a -n "$daily_clean_disk_files" ]
+ then
+ echo ""
+ echo "Removing old temporary files:"
+ set -f noglob
+ args="$args "`echo " ${daily_clean_disks_files% }" |
+ sed 's/[ ][ ]*/ -name /g'`
-exit 0 # do not run by default
+ case "$daily_clean_tmps_verbose" in
+ [Yy][Ee][Ss])
+ print=-print;;
+ *)
+ print=;;
+ esac
-find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
- \( -name '[#,]*' -o -name '.#*' -o -name a.out -o -name '*.core' \
- -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
- -a -atime +3 -delete
+ find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
+ \( $args \) -atime +$daily_clean_disks_days -delete $print
+ set -f glob
+ fi;;
+esac
diff --git a/etc/periodic/daily/110.clean-tmps b/etc/periodic/daily/110.clean-tmps
index ca6593b..0ae223b 100755
--- a/etc/periodic/daily/110.clean-tmps
+++ b/etc/periodic/daily/110.clean-tmps
@@ -3,44 +3,41 @@
# $FreeBSD$
#
# Perform temporary directory cleaning so that long-lived systems
-# don't end up with excessively old files there. If /var/tmp and
-# /tmp are symlinked together, only one of the below will actually
-# run.
+# don't end up with excessively old files there.
#
# If there is a global system configuration file, suck it in.
#
-if [ -r /etc/defaults/rc.conf ]; then
- . /etc/defaults/rc.conf
- source_rc_confs
-elif [ -r /etc/rc.conf ]; then
- . /etc/rc.conf
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
-case "$clear_daily_enable" in
+case "$daily_clean_tmps_enable" in
[Yy][Ee][Ss])
- if [ -n "$clear_daily_days" ]
+ if [ -n "$daily_clean_tmps_days" ]
then
echo ""
echo "Removing old temporary files:"
set -f noglob
- args="-atime +$clear_daily_days -mtime +$clear_daily_days"
- [ -n "$clear_daily_ignore" ] &&
- args="$args "`echo " ${clear_daily_ignore% }" |
+ args="-atime +$daily_clean_tmps_days -mtime +$daily_clean_tmps_days"
+ [ -n "$daily_clean_tmps_ignore" ] &&
+ args="$args "`echo " ${daily_clean_tmps_ignore% }" |
sed 's/[ ][ ]*/ ! -name /g'`
- case "$clear_daily_verbose" in
+ case "$daily_clean_tmps_verbose" in
[Yy][Ee][Ss])
print=-print;;
*)
print=;;
esac
- for dir in $clear_daily_dirs
+ for dir in $daily_clean_tmps_dirs
do
[ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && {
find -d . -type f $args -delete $print
- find -d . ! -name . -type d -mtime +$clear_daily_days \
+ find -d . ! -name . -type d -mtime +$daily_clean_tmps_days \
-delete $print
} | sed "s,^\\., $dir,"
done
diff --git a/etc/periodic/daily/120.clean-preserve b/etc/periodic/daily/120.clean-preserve
index 37278c1..2230a03 100755
--- a/etc/periodic/daily/120.clean-preserve
+++ b/etc/periodic/daily/120.clean-preserve
@@ -2,10 +2,33 @@
#
# $FreeBSD$
#
+# Remove stale files in /var/preserve
+#
-if [ -d /var/preserve ]; then
- echo ""
- echo "Removing stale files from /var/preserve:"
-
- cd /var/preserve && find . ! -name . -mtime +7 -delete
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_clean_preserve_enable" in
+ [Yy][Ee][Ss])
+ if [ -n "$daily_clean_preserve_days" -a -d /var/preserve ]
+ then
+ echo ""
+ echo "Removing stale files from /var/preserve:"
+
+ case "$daily_clean_preserve_verbose" in
+ [Yy][Ee][Ss])
+ print=-print;;
+ *)
+ print=;;
+ esac
+
+ cd /var/preserve &&
+ find . ! -name . -mtime +$daily_clean_preserve_days \
+ -delete $print
+ fi;;
+esac
diff --git a/etc/periodic/daily/130.clean-msgs b/etc/periodic/daily/130.clean-msgs
index 066581b..00dcef1 100755
--- a/etc/periodic/daily/130.clean-msgs
+++ b/etc/periodic/daily/130.clean-msgs
@@ -2,11 +2,26 @@
#
# $FreeBSD$
#
-# remove system messages older than 21 days
+# Remove system messages
#
-if [ -d /var/msgs ] ; then
- echo ""
- echo "Cleaning out old system announcements:"
- msgs -c
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_clean_preserve_enable" in
+ [Yy][Ee][Ss])
+ if [ -d /var/msgs ]
+ then
+ echo ""
+ echo "Cleaning out old system announcements:"
+
+ [ -n "$daily_clean_msg_days" ] &&
+ arg=-${daily_clean_msg_days#-} || arg=
+ msgs -c $arg
+ fi;;
+esac
diff --git a/etc/periodic/daily/140.clean-rwho b/etc/periodic/daily/140.clean-rwho
index 71ac4ae..9504f81 100755
--- a/etc/periodic/daily/140.clean-rwho
+++ b/etc/periodic/daily/140.clean-rwho
@@ -2,11 +2,32 @@
#
# $FreeBSD$
#
+# Remove stale files in /var/rwho
+#
-if [ -d /var/rwho ] ; then
- echo ""
- echo "Removing stale files from /var/rwho:"
-
- cd /var/rwho && find . ! -name . -mtime +7 -delete
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+case "$daily_clean_rwho_enable" in
+ [Yy][Ee][Ss])
+ if [ -n "$daily_clean_rwho_days" -a -d /var/rwho ]
+ then
+ echo ""
+ echo "Removing stale files from /var/rwho:"
+
+ case "$daily_clean_rwho_verbose" in
+ [Yy][Ee][Ss])
+ print=-print;;
+ *)
+ print=;;
+ esac
+
+ cd /var/rwho &&
+ find . ! -name . -mtime +$daily_clean_rwho_days -delete $print
+ fi;;
+esac
diff --git a/etc/periodic/daily/150.clean-hoststat b/etc/periodic/daily/150.clean-hoststat
index b335eb4..85c1e67 100755
--- a/etc/periodic/daily/150.clean-hoststat
+++ b/etc/periodic/daily/150.clean-hoststat
@@ -2,10 +2,33 @@
#
# $FreeBSD$
#
+# Remove stale files in /var/spool/.hoststat
+#
-if [ -d /var/spool/.hoststat ] ; then
- echo ""
- echo "Removing stale files from /var/spool/.hoststat:"
-
- cd /var/spool/.hoststat && find * -mtime +3 -delete
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_clean_hoststat_enable" in
+ [Yy][Ee][Ss])
+ if [ -n "$daily_clean_hoststat_days" -a -d /var/spool/.hoststat ]
+ then
+ echo ""
+ echo "Removing stale files from /var/spool/.hoststat:"
+
+ case "$daily_clean_hoststat_verbose" in
+ [Yy][Ee][Ss])
+ print=-print;;
+ *)
+ print=;;
+ esac
+
+ cd /var/hoststat &&
+ find . ! -name . -mtime +$daily_clean_hoststat_days \
+ -delete $print
+ fi;;
+esac
diff --git a/etc/periodic/daily/200.backup-passwd b/etc/periodic/daily/200.backup-passwd
index 43b12a8..b8858e7 100755
--- a/etc/periodic/daily/200.backup-passwd
+++ b/etc/periodic/daily/200.backup-passwd
@@ -2,40 +2,58 @@
#
# $FreeBSD$
#
-bak=/var/backups
-
-if [ -f /etc/master.passwd -o -f /etc/group ] ; then
- echo ""
- echo "Backup passwd and group files:"
-
- if [ ! -f $bak/master.passwd.bak ] ; then
- echo "no $bak/master.passwd.bak"
- cp -p /etc/master.passwd $bak/master.passwd.bak
- fi
-
- if cmp -s $bak/master.passwd.bak /etc/master.passwd; then :; else
- echo "$host passwd diffs:"
- diff $bak/master.passwd.bak /etc/master.passwd |\
- sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/'
- mv $bak/master.passwd.bak $bak/master.passwd.bak2
- cp -p /etc/master.passwd $bak/master.passwd.bak
- fi
-
- if [ ! -f $bak/group.bak ] ; then
- echo "no $bak/group.bak"
- cp -p /etc/group $bak/group.bak
- fi
-
- if cmp -s $bak/group.bak /etc/group; then :; else
- echo "$host group diffs:"
- diff $bak/group.bak /etc/group
- mv $bak/group.bak $bak/group.bak2
- cp -p /etc/group $bak/group.bak
- fi
-
- if [ -f /etc/group ] ; then
- echo ""
- echo "Verifying group file syntax:"
- chkgrp /etc/group
- fi
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_backup_passwd_enable" in
+ [Yy][Ee][Ss])
+ if [ -f /etc/master.passwd -o -f /etc/group ]
+ then
+ bak=/var/backups
+
+ echo ""
+ echo "Backup passwd and group files:"
+
+ if [ ! -f $bak/master.passwd.bak ]
+ then
+ echo "no $bak/master.passwd.bak"
+ cp -p /etc/master.passwd $bak/master.passwd.bak
+ fi
+
+ if ! cmp -s $bak/master.passwd.bak /etc/master.passwd
+ then
+ echo "$host passwd diffs:"
+ diff $bak/master.passwd.bak /etc/master.passwd |\
+ sed 's/^\([<>] [^:]*\):[^:]*:/\1:(password):/'
+ mv $bak/master.passwd.bak $bak/master.passwd.bak2
+ cp -p /etc/master.passwd $bak/master.passwd.bak
+ fi
+
+ if [ ! -f $bak/group.bak ]
+ then
+ echo "no $bak/group.bak"
+ cp -p /etc/group $bak/group.bak
+ fi
+
+ if ! cmp -s $bak/group.bak /etc/group
+ then
+ echo "$host group diffs:"
+ diff $bak/group.bak /etc/group
+ mv $bak/group.bak $bak/group.bak2
+ cp -p /etc/group $bak/group.bak
+ fi
+
+ if [ -f /etc/group ]
+ then
+ echo ""
+ echo "Verifying group file syntax:"
+ chkgrp /etc/group
+ fi
+ fi;;
+esac
diff --git a/etc/periodic/daily/210.backup-aliases b/etc/periodic/daily/210.backup-aliases
index fa0ae53..8122b4c3 100755
--- a/etc/periodic/daily/210.backup-aliases
+++ b/etc/periodic/daily/210.backup-aliases
@@ -2,21 +2,36 @@
#
# $FreeBSD$
#
-bak=/var/backups
-if [ -f /etc/aliases ] ; then
- echo ""
- echo "Backing up mail aliases:"
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
- if [ ! -f $bak/aliases.bak ] ; then
- echo "no $bak/aliases.bak"
- cp -p /etc/aliases $bak/aliases.bak
- fi
+case "$daily_backup_aliases_enable" in
+ [Yy][Ee][Ss])
+ if [ -f /etc/aliases ]
+ then
+ bak=/var/backups
- if cmp -s $bak/aliases.bak /etc/aliases; then :; else
- echo "$host aliases diffs:"
- diff -u $bak/aliases.bak /etc/aliases
- mv $bak/aliases.bak $bak/aliases.bak2
- cp -p /etc/aliases $bak/aliases.bak
- fi
-fi
+ echo ""
+ echo "Backing up mail aliases:"
+
+ if [ ! -f $bak/aliases.bak ]
+ then
+ echo "no $bak/aliases.bak"
+ cp -p /etc/aliases $bak/aliases.bak
+ fi
+
+ if ! cmp -s $bak/aliases.bak /etc/aliases
+ then
+ echo "$host aliases diffs:"
+ diff -u $bak/aliases.bak /etc/aliases
+ mv $bak/aliases.bak $bak/aliases.bak2
+ cp -p /etc/aliases $bak/aliases.bak
+ fi
+ fi;;
+esac
diff --git a/etc/periodic/daily/220.backup-distfile b/etc/periodic/daily/220.backup-distfile
index 16a0541..37efaea 100755
--- a/etc/periodic/daily/220.backup-distfile
+++ b/etc/periodic/daily/220.backup-distfile
@@ -2,14 +2,28 @@
#
# $FreeBSD$
#
-bak=/var/backups
-if [ -f /etc/Distfile ]; then
- echo ""
- echo "Backing up /etc/Distfile:"
-
- if cmp -s $bak/Distfile.bak /etc/Distfile; then :; else
- mv $bak/Distfile.bak $bak/Distfile.bak2
- cp /etc/Distfile $bak/Distfile.bak
- fi
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_backup_distfile_enable" in
+ [Yy][Ee][Ss])
+ if [ -f /etc/Distfile ]
+ then
+ bak=/var/backups
+
+ echo ""
+ echo "Backing up /etc/Distfile:"
+
+ if ! cmp -s $bak/Distfile.bak /etc/Distfile
+ then
+ mv $bak/Distfile.bak $bak/Distfile.bak2
+ cp /etc/Distfile $bak/Distfile.bak
+ fi
+ fi;;
+esac
diff --git a/etc/periodic/daily/300.calendar b/etc/periodic/daily/300.calendar
index de0aeec..a921bcf 100755
--- a/etc/periodic/daily/300.calendar
+++ b/etc/periodic/daily/300.calendar
@@ -8,11 +8,21 @@
# or run it from your ~/.profile or ~/.login.
#
-exit 0 # do not run by default
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
-if [ -f /usr/bin/calendar ] ; then
- echo ""
- echo "Running calendar:"
+case "$daily_calendar_enable" in
+ [Yy][Ee][Ss])
+ if [ -f /usr/bin/calendar ]
+ then
+ echo ""
+ echo "Running calendar:"
- calendar -a
-fi
+ calendar -a
+ fi;;
+esac
diff --git a/etc/periodic/daily/310.accounting b/etc/periodic/daily/310.accounting
index f713920..15e5c6d 100755
--- a/etc/periodic/daily/310.accounting
+++ b/etc/periodic/daily/310.accounting
@@ -3,14 +3,26 @@
# $FreeBSD$
#
-if [ -f /var/account/acct ] ; then
- echo ""
- echo "Rotating accounting logs and gathering statistics:"
-
- cd /var/account
- if [ -f acct.2 ] ; then mv -f acct.2 acct.3 ; fi
- if [ -f acct.1 ] ; then mv -f acct.1 acct.2 ; fi
- if [ -f acct.0 ] ; then mv -f acct.0 acct.1 ; fi
- cp -pf acct acct.0
- sa -s > /dev/null
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_accounting_enable" in
+ [Yy][Ee][Ss])
+ if [ -f /var/account/acct ]
+ then
+ echo ""
+ echo "Rotating accounting logs and gathering statistics:"
+
+ cd /var/account
+ [ -f acct.2 ] && mv -f acct.2 acct.3
+ [ -f acct.1 ] && mv -f acct.1 acct.2
+ [ -f acct.0 ] && mv -f acct.0 acct.1
+ cp -pf acct acct.0
+ sa -s >/dev/null
+ fi;;
+esac
diff --git a/etc/periodic/daily/320.rdist b/etc/periodic/daily/320.rdist
index 2673152..0095ae6 100755
--- a/etc/periodic/daily/320.rdist
+++ b/etc/periodic/daily/320.rdist
@@ -3,9 +3,21 @@
# $FreeBSD$
#
-if [ -f /etc/Distfile ]; then
- echo ""
- echo "Running rdist with /etc/Distfile:"
-
- rdist -f /etc/Distfile
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_distfile_enable" in
+ [Yy][Ee][Ss])
+ if [ -f /etc/Distfile ]
+ then
+ echo ""
+ echo "Running rdist with /etc/Distfile:"
+
+ rdist -f /etc/Distfile
+ fi;;
+esac
diff --git a/etc/periodic/daily/330.news b/etc/periodic/daily/330.news
index b7be359..dc3a3bf 100755
--- a/etc/periodic/daily/330.news
+++ b/etc/periodic/daily/330.news
@@ -6,6 +6,21 @@
# (This is present only for backwards compatibility, usually the news
# system handles this on its own).
-if [ -f /etc/news.expire ]; then
- /etc/news.expire
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_news_expire_enable" in
+ [Yy][Ee][Ss])
+ if [ -f /etc/news.expire ]
+ then
+ echo ""
+ echo "Running news.expire:"
+
+ /etc/news.expire
+ fi;;
+esac
diff --git a/etc/periodic/daily/340.uucp b/etc/periodic/daily/340.uucp
index 3ee8304..178fa63 100755
--- a/etc/periodic/daily/340.uucp
+++ b/etc/periodic/daily/340.uucp
@@ -5,10 +5,22 @@
# Local cleanup of UUCP files. This is for backwards compatibility,
# /etc/uuclean.daily doesn't exist by default.
#
-if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then
- echo ""
- echo "Cleaning up UUCP:"
- echo /etc/uuclean.daily | su -m uucp
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+case "$daily_uuclean_enable" in
+ [Yy][Ee][Ss])
+ if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]
+ then
+ echo ""
+ echo "Cleaning up UUCP:"
+
+ echo /etc/uuclean.daily | su -m uucp
+ fi;;
+esac
diff --git a/etc/periodic/daily/400.status-disks b/etc/periodic/daily/400.status-disks
index 8611318..8c82d88 100755
--- a/etc/periodic/daily/400.status-disks
+++ b/etc/periodic/daily/400.status-disks
@@ -3,12 +3,23 @@
# $FreeBSD$
#
-echo ""
-echo "Disk status:"
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
+
+case "$daily_status_disks_enable" in
+ [Yy][Ee][Ss])
+ echo ""
+ echo "Disk status:"
-df -k -t nonfs
+ df -k -t nonfs
-# display which filesystems need backing up
+ # display which filesystems need backing up
-echo ""
-dump W
+ echo ""
+ dump W;;
+esac
diff --git a/etc/periodic/daily/410.status-uucp b/etc/periodic/daily/410.status-uucp
index af8a8f6..5336477 100755
--- a/etc/periodic/daily/410.status-uucp
+++ b/etc/periodic/daily/410.status-uucp
@@ -3,9 +3,21 @@
# $FreeBSD$
#
-if [ -d /var/spool/uucp -a -x /usr/bin/uustat ]; then
- echo ""
- echo "UUCP status:"
-
- uustat -a
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_status_uucp_enable" in
+ [Yy][Ee][Ss])
+ if [ -d /var/spool/uucp -a -x /usr/bin/uustat ]
+ then
+ echo ""
+ echo "UUCP status:"
+
+ uustat -a
+ fi;;
+esac
diff --git a/etc/periodic/daily/420.status-network b/etc/periodic/daily/420.status-network
index 0d47661..c91ba06 100755
--- a/etc/periodic/daily/420.status-network
+++ b/etc/periodic/daily/420.status-network
@@ -3,9 +3,26 @@
# $FreeBSD$
#
-if [ -x /usr/bin/netstat ] ; then
- echo ""
- echo "Network interface status:"
-
- netstat -i
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_status_network_enable" in
+ [Yy][Ee][Ss])
+ if [ -x /usr/bin/netstat ]
+ then
+ echo ""
+ echo "Network interface status:"
+
+ case "$daily_status_network_enable" in
+ [Yy][Ee][Ss])
+ netstat -i;;
+ *)
+ netstat -in;;
+ esac
+ fi;;
+esac
diff --git a/etc/periodic/daily/430.status-rwho b/etc/periodic/daily/430.status-rwho
index 151898d..728f4b2 100755
--- a/etc/periodic/daily/430.status-rwho
+++ b/etc/periodic/daily/430.status-rwho
@@ -3,13 +3,25 @@
# $FreeBSD$
#
-if [ -d /var/rwho -a -x /usr/bin/rwho -a $(ls -l /var/rwho | wc -l) -ne 0 ]
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
then
- echo ""
- echo "Local network system status:"
- ruptime
-else
- echo ""
- echo "Local system status:"
- uptime
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_status_rwho_enable" in
+ [Yy][Ee][Ss])
+ rwho=$(echo /var/rwho/*)
+ if [ -x /usr/bin/rwho -a -f "${rwho%% *}" ]
+ then
+ echo ""
+ echo "Local network system status:"
+ ruptime
+ else
+ echo ""
+ echo "Local system status:"
+ uptime
+ fi;;
+esac
diff --git a/etc/periodic/daily/440.status-mailq b/etc/periodic/daily/440.status-mailq
index a9336fc..fd2a443 100755
--- a/etc/periodic/daily/440.status-mailq
+++ b/etc/periodic/daily/440.status-mailq
@@ -2,15 +2,32 @@
#
# $FreeBSD$
#
-if [ -x /usr/bin/mailq -a -d /var/spool/mqueue ] ; then
- echo ""
- echo "Mail in local queue:"
- mailq
-
- # If you run a busy mail server or mail relay, you may prefer
- # a shorter and better formatted message.
- #
- # mailq | perl -ne 'print if /^\s+\S+@/' |
- # sort | uniq -c | sort -nr | awk '$1 > 1 {print $1, $2}'
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_status_mailq_enable" in
+ [Yy][Ee][Ss])
+ if [ -x /usr/bin/mailq -a -d /var/spool/mqueue ]
+ then
+ echo ""
+ echo "Mail in local queue:"
+
+ case "$daily_status_mailq_shorten" in
+ [Yy][Ee][Ss])
+ mailq |
+ perl -ne 'print if /^\s+\S+@/' |
+ sort |
+ uniq -c |
+ sort -nr |
+ awk '$1 > 1 {print $1, $2}';;
+ *)
+ mailq;;
+ esac
+ fi;;
+esac
diff --git a/etc/periodic/daily/450.status-security b/etc/periodic/daily/450.status-security
index 92f328d..8ca962d 100755
--- a/etc/periodic/daily/450.status-security
+++ b/etc/periodic/daily/450.status-security
@@ -3,10 +3,40 @@
# $FreeBSD$
#
-if [ -f /etc/security -a -x /usr/sbin/sendmail ] ; then
- echo ""
- echo "Security check:"
- echo " (output mailed separately)"
-
- sh /etc/security 2>&1 | sendmail root
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_status_security_enable" in
+ [Yy][Ee][Ss])
+ if [ -f /etc/security -a -x /usr/sbin/sendmail ]
+ then
+ echo ""
+ echo "Security check:"
+
+ case "$daily_status_security_noamd" in
+ [Yy][Ee][Ss])
+ args=-a;;
+ *)
+ args=;;
+ esac
+
+ case "$daily_status_security_nomfs" in
+ [Yy][Ee][Ss])
+ args="$args -m";;
+ esac
+
+ case "$daily_status_security_inline" in
+ [Yy][Ee][Ss])
+ sh /etc/security -s $args;;
+
+ *)
+ echo " (output mailed separately)"
+ sh /etc/security $args 2>&1 | sendmail root;;
+ esac
+ fi;;
+esac
diff --git a/etc/periodic/daily/460.status-mail-rejects b/etc/periodic/daily/460.status-mail-rejects
index 4a29b47..43bdf7d 100755
--- a/etc/periodic/daily/460.status-mail-rejects
+++ b/etc/periodic/daily/460.status-mail-rejects
@@ -3,13 +3,25 @@
# $FreeBSD$
#
-if [ -d /etc/mail -a -f /var/log/maillog ]; then
- echo
- echo Checking for rejected mail hosts:
-
- start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'`
- zcat -fc /var/log/maillog.0* /var/log/maillog | grep reject= |
- perl -ne "print \"\$2\n\"
- if /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o;" |
- sort | uniq -c | sort -nr
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$daily_status_mail_rejects_enable" in
+ [Yy][Ee][Ss])
+ if [ -d /etc/mail -a -f /var/log/maillog ]
+ then
+ echo
+ echo Checking for rejected mail hosts:
+
+ start=`date -v-1d '+%b %d' | sed 's/0\(.\)$/ \1/'`
+ zcat -fc /var/log/maillog.0* /var/log/maillog |
+ perl -ne "print \"\$2\n\"
+ if (/reject=/ and /^$start.*ruleset=check_\S+,\s+arg1=(<[^@]+@)?([^>,]+).*reject=/o);" |
+ sort | uniq -c | sort -nr
+ fi;;
+esac
diff --git a/etc/periodic/daily/999.local b/etc/periodic/daily/999.local
index 2f715ab..307ff19 100755
--- a/etc/periodic/daily/999.local
+++ b/etc/periodic/daily/999.local
@@ -5,9 +5,25 @@
# Run the old /etc/daily.local script. This is really for backwards
# compatibility more than anything else.
#
-if [ -f /etc/daily.local ]; then
- echo ""
- echo "Running daily.local:"
- sh /etc/daily.local
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+for script in $daily_local
+do
+ case "$script" in
+ /*)
+ if [ -f "$script" ]
+ then
+ echo ""
+ echo "Running $script:"
+
+ sh $script
+ fi;;
+ esac
+done
diff --git a/etc/periodic/monthly/200.accounting b/etc/periodic/monthly/200.accounting
index fff47bf..5444ea8 100755
--- a/etc/periodic/monthly/200.accounting
+++ b/etc/periodic/monthly/200.accounting
@@ -3,12 +3,25 @@
# $FreeBSD$
#
-W=/var/log/wtmp
-if [ -f ${W}.0 ] ; then
- if [ -x /usr/sbin/ac ] ; then
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
+
+case "$monthly_accounting_enable" in
+ [Yy][Ee][Ss])
+ W=/var/log/wtmp
+ if [ -f $W.0 ]
+ then
+ if [ -x /usr/sbin/ac ]
+ then
echo ""
echo "Doing login accounting:"
- ac -p -w ${W}.0 | sort -nr +1
- fi
-fi
+ ac -p -w $W.0 | sort -nr +1
+ fi
+ fi;;
+esac
diff --git a/etc/periodic/monthly/999.local b/etc/periodic/monthly/999.local
index 75fbebd..b5d8aed 100755
--- a/etc/periodic/monthly/999.local
+++ b/etc/periodic/monthly/999.local
@@ -2,9 +2,25 @@
#
# $FreeBSD$
#
-if [ -f /etc/monthly.local ]; then
- echo ""
- echo "Running monthly.local:"
- sh /etc/monthly.local
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+for script in $monthly_local
+do
+ case "$script" in
+ /*)
+ if [ -f "$script" ]
+ then
+ echo ""
+ echo "Running $script:"
+
+ sh $script
+ fi;;
+ esac
+done
diff --git a/etc/periodic/weekly/120.clean-kvmdb b/etc/periodic/weekly/120.clean-kvmdb
index 42079c2..dbc8f4e 100755
--- a/etc/periodic/weekly/120.clean-kvmdb
+++ b/etc/periodic/weekly/120.clean-kvmdb
@@ -3,13 +3,31 @@
# $FreeBSD$
#
-if [ -d /var/db ] ; then
- echo ""
- echo "Cleaning up kernel database files:"
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]; then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
- kernel=`sysctl -n kern.bootfile`
- kernel=kvm_`basename ${kernel}`.db
+case "$weekly_clean_kvmdb_enable" in
+ [Yy][Ee][Ss])
+ if [ -d /var/db -a -n "$weekly_clean_kvmdb_days" ]
+ then
+ echo ""
+ echo "Cleaning up kernel database files:"
- find /var/db -name "kvm_*.db" -a ! -name ${kernel} -a \
- -atime +7 -delete
-fi
+ kernel=`sysctl -n kern.bootfile`
+ kernel=kvm_${kernel##*/}.db
+
+ case "$weekly_clean_kvmdb_verbose" in
+ [Yy][Ee][Ss])
+ print=-print;;
+ *)
+ print=;;
+ esac
+
+ find /var/db -name "kvm_*.db" ! -name $kernel \
+ -atime +$weekly_clean_kvmdb_days -delete $print
+ fi;;
+esac
diff --git a/etc/periodic/weekly/300.uucp b/etc/periodic/weekly/300.uucp
index eb91504..3370158 100755
--- a/etc/periodic/weekly/300.uucp
+++ b/etc/periodic/weekly/300.uucp
@@ -5,9 +5,21 @@
# This is really here for backwards compatibility, clean.weekly is not
# created by default anymore.
-if [ -d /var/spool/uucp -a -f /usr/libexec/uucp/clean.weekly ]; then
- echo ""
- echo "Cleaning up UUCP:"
-
- echo /usr/libexec/uucp/clean.weekly | su daemon
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+case "$weekly_uucp_enable" in
+ [Yy][Ee][Ss])
+ if [ -d /var/spool/uucp -a -f /usr/libexec/uucp/clean.weekly ]
+ then
+ echo ""
+ echo "Cleaning up UUCP:"
+
+ echo /usr/libexec/uucp/clean.weekly | su daemon
+ fi;;
+esac
diff --git a/etc/periodic/weekly/310.locate b/etc/periodic/weekly/310.locate
index b616a4a..53d3d80 100755
--- a/etc/periodic/weekly/310.locate
+++ b/etc/periodic/weekly/310.locate
@@ -2,16 +2,30 @@
#
# $FreeBSD$
#
-locdb=/var/db/locate.database
-if [ -x /usr/libexec/locate.updatedb -a -f $locdb ] ; then
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
- echo ""
- echo "Rebuilding locate database:"
+case "$weekly_locate_enable" in
+ [Yy][Ee][Ss])
+ if [ -x /usr/libexec/locate.updatedb -a -f $locdb ]
+ then
+ echo ""
+ echo "Rebuilding locate database:"
- touch ${locdb}; chown nobody ${locdb}; chmod 644 ${locdb}
+ locdb=/var/db/locate.database
- cd /
- echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody
- chmod 444 ${locdb}
-fi
+ touch $locdb
+ chown nobody $locdb
+ chmod 644 $locdb
+
+ cd /
+ echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody
+ chmod 444 $locdb
+ fi;;
+esac
diff --git a/etc/periodic/weekly/320.whatis b/etc/periodic/weekly/320.whatis
index 3436331..123be96 100755
--- a/etc/periodic/weekly/320.whatis
+++ b/etc/periodic/weekly/320.whatis
@@ -3,28 +3,44 @@
# $FreeBSD$
#
-if [ -x /usr/libexec/makewhatis.local -a -x /usr/bin/manpath ]; then
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
- echo ""
- echo "Rebuilding whatis database:"
+case "$weekly_whatis_enable" in
+ [Yy][Ee][Ss])
+ if [ -x /usr/libexec/makewhatis.local -a -x /usr/bin/manpath ]
+ then
+ echo ""
+ echo "Rebuilding whatis database:"
- MANPATH=`/usr/bin/manpath -q`
- if [ $? = 0 ]; then
- if [ "x${MANPATH}" = "x" ]; then
- echo "manpath failed to find any manpage directories"
- else
- man_locales=`/usr/bin/manpath -qL`
+ MANPATH=`/usr/bin/manpath -q`
+ if [ $? = 0 ]
+ then
+ if [ "x${MANPATH}" = "x" ]
+ then
+ echo "manpath failed to find any manpage directories"
+ else
+ man_locales=`/usr/bin/manpath -qL`
- # Build whatis(1) database(s) for original, non-localized manpages.
- /usr/libexec/makewhatis.local "${MANPATH}"
+ # Build whatis(1) database(s) for original, non-localized
+ # manpages.
+ /usr/libexec/makewhatis.local "${MANPATH}"
- # Build whatis(1) database(s) for localized manpages.
- if [ X"${man_locales}" != X ]; then
- for i in ${man_locales}
- do
- LC_CTYPE=$i /usr/libexec/makewhatis.local -a -L "${MANPATH}"
- done
+ # Build whatis(1) database(s) for localized manpages.
+ if [ X"${man_locales}" != X ]
+ then
+ for i in ${man_locales}
+ do
+ LC_CTYPE=$i /usr/libexec/makewhatis.local -a \
+ -L "${MANPATH}"
+ done
+ fi
+ fi
fi
- fi
- fi
-fi
+ fi;;
+esac
diff --git a/etc/periodic/weekly/330.catman b/etc/periodic/weekly/330.catman
index a2a6a8e..e446dd2 100755
--- a/etc/periodic/weekly/330.catman
+++ b/etc/periodic/weekly/330.catman
@@ -3,32 +3,44 @@
# $FreeBSD$
#
-exit 0 # do not run by default
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
-if [ -x /usr/libexec/catman.local \
- -a -d /usr/share/man/cat1 \
- -a -x /usr/bin/manpath ]; then
- echo ""
- echo "Reformatting manual pages:"
+case "$weekly_catman_enable" in
+ [Yy][Ee][Ss])
+ if [ -x /usr/libexec/catman.local -a -d /usr/share/man/cat1 -a \
+ -x /usr/bin/manpath ]
+ then
+ echo ""
+ echo "Reformatting manual pages:"
- MANPATH=`/usr/bin/manpath -q`
- if [ $? = 0 ]; then
- if [ "x${MANPATH}" = "x" ]; then
- echo "manpath failed to find any manpath directories"
- else
- man_locales=`/usr/bin/manpath -qL`
+ MANPATH=`/usr/bin/manpath -q`
+ if [ $? = 0 ]
+ then
+ if [ "x${MANPATH}" = "x" ]
+ then
+ echo "manpath failed to find any manpath directories"
+ else
+ man_locales=`/usr/bin/manpath -qL`
- # Preformat original, non-localized manpages
- echo /usr/libexec/catman.local "${MANPATH}" | su -fm man
+ # Preformat original, non-localized manpages
+ echo /usr/libexec/catman.local "$MANPATH" | su -fm man
- # Preformat localized manpages.
- if [ X"${man_locales}" != X ]; then
- for i in ${man_locales}
- do
- LC_CTYPE=$i echo /usr/libexec/catman.local -L "${MANPATH}" | \
- su -fm man
- done
- fi
- fi
- fi
-fi
+ # Preformat localized manpages.
+ if [ X"$man_locales" != X ]
+ then
+ for i in $man_locales
+ do
+ LC_CTYPE=$i echo /usr/libexec/catman.local -L \
+ "$MANPATH" | su -fm man
+ done
+ fi
+ fi
+ fi
+ fi;;
+esac
diff --git a/etc/periodic/weekly/340.noid b/etc/periodic/weekly/340.noid
index 8a94924..7ad71ea 100644
--- a/etc/periodic/weekly/340.noid
+++ b/etc/periodic/weekly/340.noid
@@ -1,14 +1,21 @@
#!/bin/sh -
#
# $FreeBSD$
+#
-exit 0 # do not run by default
-
-echo ""
-echo "Check for files belongs to an unknown user or unknown group:"
-
-# directories to be verified
-: ${NOIDSEARCHPATHS="/"}
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
+fi
-find -H $NOIDSEARCHPATHS -fstype local \( -nogroup -or -nouser \) -print
+case "$weekly_noid_enable" in
+ [Yy][Ee][Ss])
+ echo ""
+ echo "Check for files with an unknown user or group:"
+ find -H ${weekly_noid_dirs:-/} -fstype local \
+ \( -nogroup -o -nouser \) -print | sed 's/^/ /';;
+esac
diff --git a/etc/periodic/weekly/999.local b/etc/periodic/weekly/999.local
index bc9fac2..efab6f4 100755
--- a/etc/periodic/weekly/999.local
+++ b/etc/periodic/weekly/999.local
@@ -3,9 +3,24 @@
# $FreeBSD$
#
-if [ -f /etc/weekly.local ]; then
- echo ""
- echo "Running weekly.local:"
-
- sh /etc/weekly.local
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
+
+for script in $weekly_local
+do
+ case "$script" in
+ /*)
+ if [ -f "$script" ]
+ then
+ echo ""
+ echo "Running $script:"
+
+ sh $script
+ fi;;
+ esac
+done
diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile
index 6a85d05..83fc325 100644
--- a/share/man/man5/Makefile
+++ b/share/man/man5/Makefile
@@ -6,8 +6,9 @@ MAN5= a.out.5 acct.5 core.5 devfs.5 dir.5 disktab.5 ethers.5 \
elf.5 fbtab.5 fdesc.5 forward.5 fs.5 fstab.5 group.5 \
hosts.5 hosts.equiv.5 hosts.lpd.5 intro.5 kernfs.5 link.5 \
linprocfs.5 mailer.conf.5 motd.5 networks.5 passwd.5 pbm.5 \
- phones.5 procfs.5 protocols.5 rc.conf.5 remote.5 resolver.5 \
- services.5 shells.5 stab.5 sysctl.conf.5 types.5 utmp.5
+ periodic.conf.5 phones.5 procfs.5 protocols.5 rc.conf.5 \
+ remote.5 resolver.5 services.5 shells.5 stab.5 sysctl.conf.5 \
+ types.5 utmp.5
MLINKS= dir.5 dirent.5
MLINKS+=fs.5 inode.5
diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5
new file mode 100644
index 0000000..2780185
--- /dev/null
+++ b/share/man/man5/periodic.conf.5
@@ -0,0 +1,416 @@
+.\"-
+.\" Copyright (c) 2000 Brian Somers <brian@Awfulhak.org>
+.\" 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd June 22, 2000
+.Dt PERIODIC.CONF 5
+.Os FreeBSD 5.0
+.Sh NAME
+.Nm periodic.conf
+.Nd periodic job configuration information.
+.Sh DESCRIPTION
+The file
+.Nm periodic.conf
+contains a description of how daily, weekly and montly system maintenance
+jobs should run.
+It resides in the
+.Pa /etc/defaults
+directory and parts may be overridden by a file of the same name in
+.Pa /etc ,
+which itself may be overridden by the
+.Pa /etc/periodic.conf.local
+file.
+.Pp
+.Nm
+is actually sourced as a shell script from each of the periodic scripts
+and is intended to simply provide default configuration variables.
+.Pp
+The following list provides a name and short description for each
+variable you can set in the
+.Nm
+file.
+.Bl -tag -offset 4n -width 2n
+.It Ar local_periodic
+(str) List of directories to search for periodic scripts.
+.El
+.B Daily variables
+.Pp
+The following variables are used by the standard scripts that reside in
+.Pa /etc/periodic/daily :
+.Bl -tag -offset 4n -width 2n
+.It Ar daily_clean_disks_enable
+(bool) Set to
+.Dq YES
+if you want to remove all files matching
+.Ar daily_clean_disks_files
+daily.
+.It Ar daily_clean_disks_files
+(str) Set to a list of file names to match.
+Wild cards are permitted.
+.It Ar daily_clean_disks_days
+(int) When
+.Ar daily_clean_disks_enable
+is set to
+.Dq YES ,
+this must also be set to the number of days old that a file's access
+and modification times must be before it's deleted.
+.It Ar daily_clean_disks_verbose
+(bool) Set to
+.Dq YES
+if you want the removed files to be reported in your daily output.
+.It Ar daily_clean_tmps_enable
+(bool) Set to
+.Dq YES
+if you want to clear temporary directories daily.
+.It Ar daily_clean_tmps_dirs
+(str) Set to the list of directories to clear if
+.Ar daily_clean_tmps_enable
+is set to
+.Dq YES .
+.It Ar daily_clean_tmps_days
+(int) When
+.Ar daily_clean_tmps_enable
+is set, this must also be set to the number of days old that a file's access
+and modification times must be before it's deleted.
+.It Ar daily_clean_tmps_ignore
+(str) Set to the list of files that should not be deleted when
+.Ar daily_clean_tmps_enable
+is set to
+.Dq YES .
+Wild card characters are permitted.
+.It Ar daily_clean_tmps_verbose
+(bool) Set to
+.Dq YES
+if you want the removed files to be reported in your daily output.
+.It Ar daily_clean_preserve_enable
+(bool) Set to
+.Dq YES
+if you wish to remove old files from
+.Pa /var/preserve .
+.It Ar daily_clean_preserve_days
+(num) Set to the number of days that files must not have been modified before
+they are deleted.
+.It Ar daily_clean_preserve_verbose
+(bool) Set to
+.Dq YES
+if you want the removed files to be reported in your daily output.
+.It Ar daily_clean_msgs_enable
+(bool) Set to
+.Dq YES
+if you old system messages to be purged.
+.It Ar daily_clean_msgs_days
+(num) Set to the number of days that files must not have been modified before
+they are deleted.
+If this variable is left blank, the
+.Xr msgs 1
+default is used.
+.It Ar daily_clean_rwho_enable
+(bool) Set to
+.Dq YES
+if you wish old files in
+.Pa /var/who
+to be purged.
+.It Ar daily_clean_rwho_days
+(num) Set to the number of days that files must not have been modified before
+they are deleted.
+.It Ar daily_clean_rwho_verbose
+(bool) Set to
+.Dq YES
+if you want the removed files to be reported in your daily output.
+.It Ar daily_clean_hoststat_enable
+(bool) Set to
+.Dq YES
+if you wish old files in
+.Pa /var/spool/.hoststat
+to be purged.
+.It Ar daily_clean_hoststat_days
+(num) Set to the number of days that files must not have been modified before
+they are deleted.
+.It Ar daily_clean_hoststat_verbose
+(bool) Set to
+.Dq YES
+if you want the removed files to be reported in your daily output.
+.It Ar daily_backup_passwd_enable
+(bool) Set to
+.Dq YES
+if you want the
+.Pa /etc/master.passwd
+and
+.Pa /etc/group
+files backed up and reported on.
+Reporting consists of checking both files for modifications and running
+.Xr chkgrp 8
+on the
+.Pa group
+file.
+.It Ar daily_backup_aliases_enable
+(bool) Set to
+.Dq YES
+if you want the
+.Pa /etc/aliases
+file backed up and modifications to be displayed in your daily output.
+.It Ar daily_backup_distfile_enable
+(bool) Set to
+.Dq YES
+if you want the
+.Pa /etc/Distfile
+file backed up and modifications to be displayed in your daily output.
+.It Ar daily_calendar_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Ic calendar -a
+daily.
+.It Ar daily_accounting_enable
+(bool) Set to
+.Dq YES
+if you want to rotate your daily accounting files.
+No rotations are necessary unless
+.Ar accounting_enable
+is enabled in
+.Xr rc.conf 5 .
+.It Ar daily_distfile_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Xr rdist 1
+daily.
+The
+.Pa /etc/Distfile
+file must also exist.
+.It Pa daily_news_expire_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Pa /etc/news.expire .
+.It Pa daily_uuclean_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Pa /etc/uuclean.daily .
+.it Ar daily_status_disks_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Ic df -k -t nonfs
+and
+.Ic dump W .
+.It Ar daily_status_uucp_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Pa /etc/uuclean.daily .
+.It Ar daily_status_network_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Ic netstat -i .
+.It Ar daily_status_network_usedns
+(bool) Set to
+.Dq YES
+if you want to run
+.Xr netstat 1
+without the
+.Fl n
+option (to do DNS lookups).
+.It Ar daily_status_rwho_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Xr uptime 1
+(or
+.Xr ruptime 1
+if
+.Ar rwhod_enable
+is set to
+.Dq YES
+in
+.Pa /etc/rc.conf ).
+.It Ar daily_status_mailq_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Xr mailq 1 .
+.It Ar daily_status_mailq_shorten
+(bool) Set to
+.Dq YES
+if you want to shorten the
+.Nm mailq
+output when
+.Ar daily_status_mailq_enable
+is set to
+.Dq YES .
+.It Ar daily_status_security_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Pa /etc/security .
+.It Ar daily_status_security_inline
+(bool) Set to
+.Dq YES
+if you want to run
+.Pa /etc/security
+inline.
+The alternative is to run it as a background job, mailing the output to
+.An root .
+.It Ar daily_status_security_noamd
+(bool) Set to
+.Dq YES
+if you want to ignore
+.Xr amd 8
+mounts when comparing against yesterdays filesystem mounts.
+.It Ar daily_status_security_nomfs
+(bool) Set to
+.Dq YES
+if you want to ignore
+.Xr mfs 8
+mounts when comparing against yesterdays filesystem mounts.
+.It Ar daily_status_mail_rejects_enable
+(bool) Set to
+.Dq YES
+if you want to summarise mail rejections logged to
+.Pa /var/log/maillog
+for the previous day.
+.It Ar daily_local
+(str) Set to a list of extra scripts that should be run after all other
+daily scripts.
+All scripts must be absolute path names.
+.El
+.Pp
+The following variables are used by the standard scripts that reside in
+.Pa /etc/periodic/weekly :
+.Bl -tag -offset 4n -width 2n
+.It Ar weekly_clean_kvmdb_enable
+(bool) Set to
+.Dq YES
+if you want to purge old
+.Pa /var/db/kvm_*.db
+files.
+The kvm file for the current kernel will not be purged.
+.It Ar weekly_clean_kvmdb_days
+(num) Set to the number of days that the file must not have been accessed
+before being deleted.
+.It Ar weekly_clean_kvmdb_verbose
+(bool) Set to
+.Dq YES
+if you want the removed files to be reported in your daily output.
+.It Ar weekly_uucp_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Pa /usr/libexec/uucp/clean.weekly .
+.It Ar weekly_locate_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Pa /usr/libexec/locate.updatedb .
+This script is run using
+.Ic nice -5
+as user
+.An nobody ,
+and generates the table used by the
+.Xr locate 1
+command.
+.It Ar weekly_whatis_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Pa /usr/libexec/makewhatis.local .
+This script regenerates the database used by the
+.Xr apropos 1
+command.
+.It Ar weekly_catman_enable
+(bool) Set to
+.Dq YES
+if you want to run
+.Pa /usr/libexec/catman.local .
+This script processes all out of date man pages, speeding up the
+.Xr man 1
+command at the expense of disk space.
+.It Ar weekly_noid_enable
+(bool) Set to
+.Dq YES
+if you want to locate orphaned files on the system.
+An orphaned file is one with an invalid owner or group.
+.It Ar weekly_noid_dirs
+(str) A list of directories under which orphaned files are searched for.
+This would usually be set to
+.Pa / .
+.It Ar weekly_local
+(str) Set to a list of extra scripts that should be run after all other
+weekly scripts.
+All scripts must be absolute path names.
+.El
+.Pp
+The following variables are used by the standard scripts that reside in
+.Pa /etc/periodic/monthly :
+.Bl -tag -offset 4n -width 2n
+.It Ar monthly_accounting_enable
+(bool) Set to
+.Dq YES
+if you want to do login accounting using the
+.Xr ac 8
+command.
+.It Ar monthly_local
+(str) Set to a list of extra scripts that should be run after all other
+monthly scripts.
+All scripts must be absolute path names.
+.El
+.Sh FILES
+.Bl -tag -width /etc/defaults/periodic.conf
+.It Pa /etc/defaults/periodic.conf
+The default configuration file.
+This file contains all default variables and values.
+.It Pa /etc/periodic.conf
+The usual system specific variable override file.
+.It Pa /etc/periodic.conf.local
+An additional override file, useful when
+.Pa /etc/periodic.conf
+is shared or distributed.
+.El
+.Sh SEE ALSO
+.Xr apropos 1 ,
+.Xr calendar 1 ,
+.Xr df 1 ,
+.Xr locate 1 ,
+.Xr man 1 ,
+.Xr msgs 1 ,
+.Xr netstat 1 ,
+.Xr nice 1 ,
+.Xr rdist 1 ,
+.Xr rc.conf 5 ,
+.Xr ac 8 ,
+.Xr chkgrp 8 ,
+.Xr dump 8 ,
+.Xr mfs 8 .
+.Xr periodic 8 .
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Fx 5.0 .
+.Sh AUTHORS
+.An Brian Somers Aq brian@Awfulhak.org .
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index cf31564..8ac2899 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -124,8 +124,6 @@ these are the flags to pass to the
daemon.
.It Ar local_startup
(str) List of directories to search for startup script files.
-.It Ar local_periodic
-(str) List of directories to search for periodic scripts.
.It Ar hostname
(str) The Fully Qualified Domain Name of your host on the network.
This should almost certainly be set to something meaningful, even if
@@ -1153,30 +1151,6 @@ boot time.
if you want
.Pa /tmp
to be cleaned at startup.
-.It Ar clear_daily_enable
-(bool) Set to
-.Ar YES
-if you want to clear temporary directories daily.
-.It Ar clear_daily_dirs
-(str) Set to the list of directories to clear if
-.Ar clear_daily_enable
-is set to
-.Ar YES .
-.It Ar clear_daily_days
-(int) When
-.Ar clear_daily_enable
-is set, this must also be set to the number of days old that a file's access
-and modification times must be before it's deleted.
-.It Ar clear_daily_ignore
-(str) Set to the list of files that should not be deleted when
-.Ar clear_daily_enable
-is set to
-.Ar YES .
-Wild cards are permitted.
-.It Ar clear_daily_verbose
-(bool) Set to
-.Ar YES
-if you want the removed files to be reported in your daily output.
.It Ar ldconfig_paths
(str) Set to the list of shared library paths to use with
.Xr ldconfig 8 .
@@ -1238,7 +1212,6 @@ at system boot time.
.Xr nfsiod 8 ,
.Xr ntpdate 8 ,
.Xr pcnfsd 8 ,
-.Xr periodic 8 ,
.Xr portmap 8 ,
.Xr quotacheck 8 ,
.Xr rc 8 ,
diff --git a/usr.sbin/periodic/periodic.8 b/usr.sbin/periodic/periodic.8
index 97957ac..4d3d3ea 100644
--- a/usr.sbin/periodic/periodic.8
+++ b/usr.sbin/periodic/periodic.8
@@ -86,9 +86,9 @@ The top level directory containing
and
.Pa monthly
subdirectories which contain standard system periodic executables.
-.It Pa /etc/defaults/rc.conf
+.It Pa /etc/defaults/periodic.conf
The
-.Pa rc.conf
+.Pa periodic.conf
system registry contains a variable
.Va local_periodic
which may be configured to specify additional top level standard
@@ -107,14 +107,17 @@ similar to the following example:
.Dl 0 3 * * 6 root periodic weekly 2>&1
.Dl 0 5 1 * * root periodic monthly 2>&1
.Pp
-Additionally, the system registry will typically have a
+Additionally, the
+.Pa /etc/defaults/periodic.conf
+system registry will typically have a
.Va local_periodic
variable reading:
-.Dl local_periodic="/usr/local/etc/periodic /usr/X11R6/etc/periodic" # periodic script dirs
+.Pp
+.Dl local_periodic="/usr/local/etc/periodic /usr/X11R6/etc/periodic"
.Sh SEE ALSO
.Xr sh 1 ,
.Xr crontab 5 ,
-.Xr rc.conf 5 ,
+.Xr periodic.conf 5 ,
.Xr cron 8
.Rs
.Sh DIAGNOSTICS
diff --git a/usr.sbin/periodic/periodic.sh b/usr.sbin/periodic/periodic.sh
index 479228b..7141710 100644
--- a/usr.sbin/periodic/periodic.sh
+++ b/usr.sbin/periodic/periodic.sh
@@ -20,11 +20,9 @@ fi
# If possible, check the global system configuration file,
# to see if there are additional dirs to check
-if [ -r /etc/defaults/rc.conf ]; then
- . /etc/defaults/rc.conf
- source_rc_confs
-elif [ -r /etc/rc.conf ]; then
- . /etc/rc.conf
+if [ -r /etc/defaults/periodic.conf ]; then
+ . /etc/defaults/periodic.conf
+ source_periodic_confs
fi
dir=$1
OpenPOWER on IntegriCloud