110.clean-tmps revision 61458
1#!/bin/sh 2# 3# $FreeBSD: head/etc/periodic/daily/110.clean-tmps 61458 2000-06-09 17:05:11Z brian $ 4# 5# Perform temporary directory cleaning so that long-lived systems 6# don't end up with excessively old files there. If /var/tmp and 7# /tmp are symlinked together, only one of the below will actually 8# run. 9# 10 11# If there is a global system configuration file, suck it in. 12# 13if [ -r /etc/defaults/rc.conf ]; then 14 . /etc/defaults/rc.conf 15 source_rc_confs 16elif [ -r /etc/rc.conf ]; then 17 . /etc/rc.conf 18fi 19 20case "$clear_daily_enable" in 21 [Yy][Ee][Ss]) 22 if [ -n "$clear_daily_days" ] 23 then 24 echo "" 25 echo "Removing old temporary files:" 26 27 set -f noglob 28 args="-atime +$clear_daily_days -mtime +$clear_daily_days" 29 [ -n "$clear_daily_ignore" ] && 30 args="$args "`echo " ${clear_daily_ignore% }" | 31 sed 's/[ ][ ]*/ ! -name /g'` 32 case "$clear_daily_verbose" in 33 [Yy][Ee][Ss]) 34 print=-print;; 35 *) 36 print=;; 37 esac 38 39 for dir in $clear_daily_dirs 40 do 41 [ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && { 42 find -d . -type f $args -delete $print 43 find -d . ! -name . -type d -mtime +$clear_daily_days \ 44 -delete $print 45 } | sed "s,^\\., $dir," 46 done 47 set -f glob 48 fi;; 49esac 50