summaryrefslogtreecommitdiffstats
path: root/etc/periodic/weekly
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-09-14 17:19:15 +0000
committerbrian <brian@FreeBSD.org>2000-09-14 17:19:15 +0000
commit4484d23ba731b5a116bedf7b28421514aa70f53b (patch)
treec37ec10ec51a7430c5a8044972107e92a18f16b0 /etc/periodic/weekly
parentd63a19c1e21807290eba99997d2935286893fede (diff)
downloadFreeBSD-src-4484d23ba731b5a116bedf7b28421514aa70f53b.zip
FreeBSD-src-4484d23ba731b5a116bedf7b28421514aa70f53b.tar.gz
Another overhaul of the periodic stuff.
All periodic sub-scripts <larf> now have their return codes interpreted by periodic(8). Output may be masked based on variable values in periodic.conf. It's also now possible to email periodic output to arbitrary addresses, or to send it to a log file, examples of which can be found in newsyslog.conf. The upshot of it all should be no discernable changes to the default behaviour of periodic(8). PR: 21250
Diffstat (limited to 'etc/periodic/weekly')
-rwxr-xr-xetc/periodic/weekly/120.clean-kvmdb22
-rwxr-xr-xetc/periodic/weekly/300.uucp17
-rwxr-xr-xetc/periodic/weekly/310.locate25
-rwxr-xr-xetc/periodic/weekly/320.whatis51
-rwxr-xr-xetc/periodic/weekly/330.catman24
-rw-r--r--etc/periodic/weekly/340.noid10
-rwxr-xr-xetc/periodic/weekly/400.status-pkg10
-rwxr-xr-xetc/periodic/weekly/999.local11
8 files changed, 120 insertions, 50 deletions
diff --git a/etc/periodic/weekly/120.clean-kvmdb b/etc/periodic/weekly/120.clean-kvmdb
index dbc8f4e..603e70b 100755
--- a/etc/periodic/weekly/120.clean-kvmdb
+++ b/etc/periodic/weekly/120.clean-kvmdb
@@ -12,8 +12,17 @@ fi
case "$weekly_clean_kvmdb_enable" in
[Yy][Ee][Ss])
- if [ -d /var/db -a -n "$weekly_clean_kvmdb_days" ]
+ if [ ! -d /var/db ]
then
+ echo '$weekly_clean_kvmdb_enable is set but /var/db' \
+ "doesn't exist"
+ rc=2
+ elif [ -z "$weekly_clean_kvmdb_days" ]
+ then
+ echo '$weekly_clean_kvmdb_enable is set but' \
+ '$weekly_clean_kvmdb_days is not'
+ rc=2
+ else
echo ""
echo "Cleaning up kernel database files:"
@@ -27,7 +36,14 @@ case "$weekly_clean_kvmdb_enable" in
print=;;
esac
- find /var/db -name "kvm_*.db" ! -name $kernel \
- -atime +$weekly_clean_kvmdb_days -delete $print
+ rc=$(find /var/db -name "kvm_*.db" ! -name $kernel \
+ -atime +$weekly_clean_kvmdb_days -delete $print |
+ tee /dev/stderr | wc -l)
+ [ -z "$print" ] && rc=0
+ [ $rc -gt 1 ] && rc=1
fi;;
+
+ *) rc=0;;
esac
+
+exit $rc
diff --git a/etc/periodic/weekly/300.uucp b/etc/periodic/weekly/300.uucp
index 3370158..1d146bc 100755
--- a/etc/periodic/weekly/300.uucp
+++ b/etc/periodic/weekly/300.uucp
@@ -15,11 +15,24 @@ fi
case "$weekly_uucp_enable" in
[Yy][Ee][Ss])
- if [ -d /var/spool/uucp -a -f /usr/libexec/uucp/clean.weekly ]
+ if [ ! -d /var/spool/uucp ]
then
+ echo '$weekly_uucp_enable is set but /var/spool/uucp' \
+ "doesn't exist"
+ rc=2
+ elif [ ! -x /usr/libexec/uucp/clean.weekly ]
+ then
+ echo '$weekly_uucp_enable is set but' \
+ "/usr/libexec/uucp/clean.weekly isn't executable"
+ rc=2
+ else
echo ""
echo "Cleaning up UUCP:"
- echo /usr/libexec/uucp/clean.weekly | su daemon
+ echo /usr/libexec/uucp/clean.weekly | su -m daemon && rc=0 || rc=3
fi;;
+
+ *) rc=0;;
esac
+
+exit $rc
diff --git a/etc/periodic/weekly/310.locate b/etc/periodic/weekly/310.locate
index 53d3d80..e6921ab 100755
--- a/etc/periodic/weekly/310.locate
+++ b/etc/periodic/weekly/310.locate
@@ -13,19 +13,20 @@ fi
case "$weekly_locate_enable" in
[Yy][Ee][Ss])
- if [ -x /usr/libexec/locate.updatedb -a -f $locdb ]
- then
- echo ""
- echo "Rebuilding locate database:"
+ echo ""
+ echo "Rebuilding locate database:"
- locdb=/var/db/locate.database
+ locdb=/var/db/locate.database
- touch $locdb
- chown nobody $locdb
- chmod 644 $locdb
+ touch $locdb && rc=0 || rc=3
+ chown nobody $locdb || rc=3
+ chmod 644 $locdb || rc=3
- cd /
- echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody
- chmod 444 $locdb
- fi;;
+ cd /
+ echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody || rc=3
+ chmod 444 $locdb || rc=3;;
+
+ *) rc=0;;
esac
+
+exit $rc
diff --git a/etc/periodic/weekly/320.whatis b/etc/periodic/weekly/320.whatis
index 123be96..6af7747 100755
--- a/etc/periodic/weekly/320.whatis
+++ b/etc/periodic/weekly/320.whatis
@@ -13,34 +13,39 @@ fi
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:"
+ echo ""
+ echo "Rebuilding whatis database:"
- MANPATH=`/usr/bin/manpath -q`
- if [ $? = 0 ]
+ MANPATH=`/usr/bin/manpath -q`
+ if [ $? = 0 ]
+ then
+ if [ -z "${MANPATH}" ]
then
- if [ "x${MANPATH}" = "x" ]
- then
- echo "manpath failed to find any manpage directories"
- else
- man_locales=`/usr/bin/manpath -qL`
+ echo "manpath failed to find any manpage directories"
+ rc=3
+ else
+ man_locales=`/usr/bin/manpath -qL`
+ rc=0
- # 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}" || rc=3
- # 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
+ # 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}" || rc=3
+ done
fi
fi
+ else
+ rc=3
fi;;
+
+ *) rc=0;;
esac
+
+exit $rc
diff --git a/etc/periodic/weekly/330.catman b/etc/periodic/weekly/330.catman
index e446dd2..999913f 100755
--- a/etc/periodic/weekly/330.catman
+++ b/etc/periodic/weekly/330.catman
@@ -13,34 +13,46 @@ fi
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 ]
+ if [ ! -d /usr/share/man/cat1 ]
then
+ echo '$weekly_catman_enable is set but /usr/share/man/cat1' \
+ "doesn't exist"
+ rc=2
+ else
echo ""
echo "Reformatting manual pages:"
MANPATH=`/usr/bin/manpath -q`
if [ $? = 0 ]
then
- if [ "x${MANPATH}" = "x" ]
+ if [ -z "${MANPATH}" ]
then
echo "manpath failed to find any manpath directories"
+ rc=3
else
man_locales=`/usr/bin/manpath -qL`
+ rc=0
# Preformat original, non-localized manpages
- echo /usr/libexec/catman.local "$MANPATH" | su -fm man
+ echo /usr/libexec/catman.local "$MANPATH" |
+ su -fm man || rc=3
# Preformat localized manpages.
- if [ X"$man_locales" != X ]
+ if [ -n "$man_locales" ]
then
for i in $man_locales
do
LC_CTYPE=$i echo /usr/libexec/catman.local -L \
- "$MANPATH" | su -fm man
+ "$MANPATH" | su -fm man || rc=3
done
fi
fi
+ else
+ rc=3
fi
fi;;
+
+ *) rc=0;;
esac
+
+exit $rc
diff --git a/etc/periodic/weekly/340.noid b/etc/periodic/weekly/340.noid
index 7ad71ea..7b56f01 100644
--- a/etc/periodic/weekly/340.noid
+++ b/etc/periodic/weekly/340.noid
@@ -16,6 +16,12 @@ case "$weekly_noid_enable" in
echo ""
echo "Check for files with an unknown user or group:"
- find -H ${weekly_noid_dirs:-/} -fstype local \
- \( -nogroup -o -nouser \) -print | sed 's/^/ /';;
+ rc=$(find -H ${weekly_noid_dirs:-/} -fstype local \
+ \( -nogroup -o -nouser \) -print | sed 's/^/ /' |
+ tee /dev/stderr | wc -l)
+ [ $rc -gt 1 ] && rc=1;;
+
+ *) rc=0;;
esac
+
+exit $rc
diff --git a/etc/periodic/weekly/400.status-pkg b/etc/periodic/weekly/400.status-pkg
index aac228b..050b47b 100755
--- a/etc/periodic/weekly/400.status-pkg
+++ b/etc/periodic/weekly/400.status-pkg
@@ -16,5 +16,13 @@ case "$weekly_status_pkg_enable" in
echo ""
echo "Check for out of date packages:"
- pkg_version -v | sed -n 's/^\([^ ]*\) *< */ \1 /p';;
+ rc=$(pkg_version -v |
+ sed -n 's/^\([^ ]*\) *< */ \1 /p' |
+ tee /dev/stderr |
+ wc -l)
+ [ $rc -gt 1 ] && rc=1;;
+
+ *) rc=0;;
esac
+
+exit $rc
diff --git a/etc/periodic/weekly/999.local b/etc/periodic/weekly/999.local
index efab6f4..f8b74d2 100755
--- a/etc/periodic/weekly/999.local
+++ b/etc/periodic/weekly/999.local
@@ -11,6 +11,7 @@ then
source_periodic_confs
fi
+rc=0
for script in $weekly_local
do
case "$script" in
@@ -20,7 +21,15 @@ do
echo ""
echo "Running $script:"
- sh $script
+ sh $script || rc=3
+ else
+ echo "$script: No such file"
+ [ $rc -lt 2 ] && rc=2
fi;;
+ *)
+ echo "$script: Not an absolute path"
+ [ $rc -lt 2 ] && rc=2;;
esac
done
+
+exit $rc
OpenPOWER on IntegriCloud