1#!/bin/sh 2# 3# $FreeBSD: src/etc/periodic/daily/150.clean-hoststat,v 1.3.2.2 2000/09/20 02:46:15 jkh Exp $ 4# 5# Remove stale files in /var/spool/.hoststat 6# 7 8# If there is a global system configuration file, suck it in. 9# 10if [ -r /etc/defaults/periodic.conf ] 11then 12 . /etc/defaults/periodic.conf 13 source_periodic_confs 14fi 15 16case "$daily_clean_hoststat_enable" in 17 [Yy][Ee][Ss]) 18 if [ -z "$daily_clean_hoststat_days" ] 19 then 20 echo '$daily_clean_hoststat_enable is enabled but' \ 21 '$daily_clean_hoststat_days is not set' 22 rc=2 23 elif [ ! -d /var/spool/.hoststat ] 24 then 25 echo '$daily_clean_hoststat_enable is enabled but' \ 26 "/var/spool/.hoststat doesn't exist" 27 rc=2 28 else 29 echo "" 30 echo "Removing stale files from /var/spool/.hoststat:" 31 32 case "$daily_clean_hoststat_verbose" in 33 [Yy][Ee][Ss]) 34 print=-print;; 35 *) 36 print=;; 37 esac 38 39 if cd /var/hoststat 40 then 41 rc=$(find . ! -name . -mtime +$daily_clean_hoststat_days \ 42 -delete $print | tee /dev/stderr | wc -l) 43 [ -z "$print" ] && rc=0 44 [ $rc -gt 1 ] && rc=1 45 else 46 rc=3 47 fi 48 fi;; 49 50 *) rc=0;; 51esac 52 53exit $rc 54