3 # $FreeBSD: src/etc/periodic/daily/110.clean-tmps,v 1.6.2.4 2002/10/13 19:59:01 joerg Exp $
4 # $DragonFly: src/etc/periodic/daily/110.clean-tmps,v 1.2 2003/06/17 04:24:48 dillon Exp $
6 # Perform temporary directory cleaning so that long-lived systems
7 # don't end up with excessively old files there.
10 # If there is a global system configuration file, suck it in.
12 if [ -r /etc/defaults/periodic.conf ]
14 . /etc/defaults/periodic.conf
18 case "$daily_clean_tmps_enable" in
20 if [ -z "$daily_clean_tmps_days" ]
22 echo '$daily_clean_tmps_enable is set but' \
23 '$daily_clean_tmps_days is not'
27 echo "Removing old temporary files:"
30 args="-atime +$daily_clean_tmps_days -mtime +$daily_clean_tmps_days"
31 args="${args} -ctime +$daily_clean_tmps_days"
32 [ -n "$daily_clean_tmps_ignore" ] &&
33 args="$args "`echo " ${daily_clean_tmps_ignore% }" |
34 sed 's/[ ][ ]*/ ! -name /g'`
35 case "$daily_clean_tmps_verbose" in
42 rc=$(for dir in $daily_clean_tmps_dirs
44 [ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && {
45 find -d . -type f $args -delete $print
46 find -d . ! -name . -type d -empty -mtime \
47 +$daily_clean_tmps_days -delete $print
48 } | sed "s,^\\., $dir,"
49 done | tee /dev/stderr | wc -l)
50 [ -z "$print" ] && rc=0