1#!/bin/sh 2# 3# 4# Remove garbage files more than $daily_clean_disks_days days old 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_disks_enable" in 16 [Yy][Ee][Ss]) 17 if [ -z "$daily_clean_disks_days" ] 18 then 19 echo '$daily_clean_disks_enable is set but' \ 20 '$daily_clean_disks_days is not' 21 rc=2 22 elif [ -z "$daily_clean_disks_files" ] 23 then 24 echo '$daily_clean_disks_enable is set but' \ 25 '$daily_clean_disks_files is not' 26 rc=2 27 else 28 echo "" 29 echo "Cleaning disks:" 30 set -f noglob 31 args="-name "`echo "$daily_clean_disks_files" | 32 sed -e 's/^[ ]*//' \ 33 -e 's/[ ]*$//' \ 34 -e 's/[ ][ ]*/ -o -name /g'` 35 36 case "$daily_clean_disks_verbose" in 37 [Yy][Ee][Ss]) 38 print=-print;; 39 *) 40 print=;; 41 esac 42 43 rc=$(find / \( ! -fstype local -o -fstype rdonly \) -prune -o \ 44 \( $args \) -atime +$daily_clean_disks_days \ 45 -execdir rm -df {} \; $print | tee /dev/stderr | wc -l) 46 [ -z "$print" ] && rc=0 47 [ $rc -gt 1 ] && rc=1 48 set -f glob 49 fi;; 50 51 *) rc=0;; 52esac 53 54exit $rc 55