3 # $FreeBSD: src/etc/periodic/daily/110.clean-tmps,v 1.13 2004/02/28 04:58:40 ache Exp $
4 # $DragonFly: src/etc/periodic/daily/110.clean-tmps,v 1.3 2007/12/29 21:44:44 matthias 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 dargs="-empty -mtime +$daily_clean_tmps_days"
33 [ -n "$daily_clean_tmps_ignore" ] && {
34 args="$args "`echo " ${daily_clean_tmps_ignore% }" |
35 sed 's/[ ][ ]*/ ! -name /g'`
36 dargs="$dargs "`echo " ${daily_clean_tmps_ignore% }" |
37 sed 's/[ ][ ]*/ ! -name /g'`
39 case "$daily_clean_tmps_verbose" in
46 rc=$(for dir in $daily_clean_tmps_dirs
48 [ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && {
49 find -d . -type f $args -delete $print
50 find -d . ! -name . -type d $dargs -delete $print
51 } | sed "s,^\\., $dir,"
52 done | tee /dev/stderr | wc -l)
53 [ -z "$print" ] && rc=0