aboutsummaryrefslogtreecommitdiff
path: root/etc/periodic
diff options
context:
space:
mode:
Diffstat (limited to 'etc/periodic')
-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
31 files changed, 734 insertions, 271 deletions
diff --git a/etc/periodic/daily/100.clean-disks b/etc/periodic/daily/100.clean-disks
index e6b744aa89ec..2efe3b5d6f1f 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 ca6593be7053..0ae223bf3157 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 37278c10556e..2230a03474a5 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 066581bf7748..00dcef14691d 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 71ac4ae3fe79..9504f81afb4e 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 b335eb429bee..85c1e6788ab0 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 43b12a88582e..b8858e7a7e17 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 fa0ae531b227..8122b4c3f40f 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 16a0541570a2..37efaea15b21 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 de0aeec71348..a921bcf96224 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 f713920fe2a3..15e5c6de1caa 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 267315271706..0095ae63ee2a 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 b7be359d29b0..dc3a3bfa677c 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 3ee830440f51..178fa63b1c99 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 86113183108e..8c82d8866b4c 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 af8a8f6d3127..53364774a0b4 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 0d47661f4c17..c91ba06ebad1 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 151898d4646b..728f4b2a2d42 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 a9336fcf4c12..fd2a4430ff83 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 92f328d4893b..8ca962dc1af0 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 4a29b47bf638..43bdf7dad7aa 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 2f715abb595e..307ff194df9f 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 fff47bfbfc83..5444ea860bba 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 75fbebdb169a..b5d8aeda1c25 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 42079c28089d..dbc8f4e444bb 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 eb915044d32b..3370158805ad 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 b616a4ab4573..53d3d8001641 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 34363318698b..123be9670d7b 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 a2a6a8ee8e2a..e446dd22662c 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 8a94924b6703..7ad71ea07f57 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 bc9fac288c04..efab6f4b25d8 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