diff options
author | Brian Somers <brian@FreeBSD.org> | 2000-09-14 17:19:15 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2000-09-14 17:19:15 +0000 |
commit | 9ed55d11927f19588b8aef6f62573088ef326533 (patch) | |
tree | c31f792ea5c6e9dc64b4548ce1eac04f000541b2 /etc/periodic/weekly | |
parent | cb144e905c51d496dc25e6c2e9c99ba603d00a02 (diff) | |
download | src-9ed55d11927f19588b8aef6f62573088ef326533.tar.gz src-9ed55d11927f19588b8aef6f62573088ef326533.zip |
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
Notes
Notes:
svn path=/head/; revision=65843
Diffstat (limited to 'etc/periodic/weekly')
-rwxr-xr-x | etc/periodic/weekly/120.clean-kvmdb | 22 | ||||
-rwxr-xr-x | etc/periodic/weekly/300.uucp | 17 | ||||
-rwxr-xr-x | etc/periodic/weekly/310.locate | 25 | ||||
-rwxr-xr-x | etc/periodic/weekly/320.whatis | 51 | ||||
-rwxr-xr-x | etc/periodic/weekly/330.catman | 24 | ||||
-rw-r--r-- | etc/periodic/weekly/340.noid | 10 | ||||
-rwxr-xr-x | etc/periodic/weekly/400.status-pkg | 10 | ||||
-rwxr-xr-x | etc/periodic/weekly/999.local | 11 |
8 files changed, 120 insertions, 50 deletions
diff --git a/etc/periodic/weekly/120.clean-kvmdb b/etc/periodic/weekly/120.clean-kvmdb index dbc8f4e444bb..603e70b0d017 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 3370158805ad..1d146bc05cba 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 53d3d8001641..e6921ab56e82 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 123be9670d7b..6af77477a22c 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 e446dd22662c..999913fb7025 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 7ad71ea07f57..7b56f019a40e 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 aac228bc9484..050b47b8ae5b 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 efab6f4b25d8..f8b74d2df724 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 |