1#!/bin/sh 2# 3# $FreeBSD$ 4# 5# Remove stale files in /var/preserve 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_preserve_enable" in 17 [Yy][Ee][Ss]) 18 if [ -z "$daily_clean_preserve_days" ] 19 then 20 echo '$daily_clean_preserve_enable is set but' \ 21 '$daily_clean_preserve_days is not' 22 rc=2 23 elif [ ! -d /var/preserve ] 24 then 25 echo '$daily_clean_preserve_enable is set but /var/preserve' \ 26 "doesn't exist" 27 rc=2 28 else 29 echo "" 30 echo "Removing stale files from /var/preserve:" 31 32 if cd /var/preserve 33 then 34 case "$daily_clean_preserve_verbose" in 35 [Yy][Ee][Ss]) 36 print=-print;; 37 *) 38 print=;; 39 esac 40 41 rc=$(find . ! -name . -mtime +$daily_clean_preserve_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