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