--- 110.clean-tmps.orig Mon Jan 28 07:13:17 2002 +++ 110.clean-tmps Mon Mar 4 12:00:53 2002 @@ -36,15 +36,40 @@ *) print=;; esac + case "$daily_clean_tmps_prune" in + [Yy][Ee][Ss]) + delete=-delete;; + *) + delete=;; + esac + # $print is currently meaningless, but retained for if + # and when 'find' without "-print" actually inhibits output. + # $out is a hack until then. + + out=/var/run/_110_clean_tmps_out.$$ + tmp=/var/run/_110_clean_tmps_tmp.$$ rc=$(for dir in $daily_clean_tmps_dirs do [ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && { find -d . -type f $args -delete $print find -d . ! -name . -type d -empty -mtime \ - +$daily_clean_tmps_days -delete $print + +$daily_clean_tmps_days $delete $print > $tmp + if [ -s $tmp ]; then + echo -n " Empty directories" + [ -n "$delete" ] && echo -n " removed" + echo ":" + sed "s,^\\., $dir," $tmp + fi } | sed "s,^\\., $dir," - done | tee /dev/stderr | wc -l) + done | tee $out | wc -l) + if [ -n "$print" ] + then + cat $out + else + echo " (output inhibited)" + fi + rm -f $out $tmp [ -z "$print" ] && rc=0 [ $rc -gt 1 ] && rc=1 set -f glob