]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/periodic/daily/110.clean-tmps
This commit was generated by cvs2svn to compensate for changes in r64866,
[FreeBSD/FreeBSD.git] / etc / periodic / daily / 110.clean-tmps
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5 # Perform temporary directory cleaning so that long-lived systems
6 # don't end up with excessively old files there.
7 #
8
9 # If there is a global system configuration file, suck it in.
10 #
11 if [ -r /etc/defaults/periodic.conf ]
12 then
13     . /etc/defaults/periodic.conf
14     source_periodic_confs
15 fi
16
17 case "$daily_clean_tmps_enable" in
18     [Yy][Ee][Ss])
19         if [ -n "$daily_clean_tmps_days" ]
20         then
21             echo ""
22             echo "Removing old temporary files:"
23
24             set -f noglob
25             args="-atime +$daily_clean_tmps_days -mtime +$daily_clean_tmps_days"
26             [ -n "$daily_clean_tmps_ignore" ] &&
27                 args="$args "`echo " ${daily_clean_tmps_ignore% }" |
28                     sed 's/[    ][      ]*/ ! -name /g'`
29             case "$daily_clean_tmps_verbose" in
30                 [Yy][Ee][Ss])
31                     print=-print;;
32                 *)
33                     print=;;
34             esac
35
36             for dir in $daily_clean_tmps_dirs
37             do
38                 [ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && {
39                     find -d . -type f $args -delete $print
40                     find -d . ! -name . -type d -mtime +$daily_clean_tmps_days \
41                         -delete $print
42                 } | sed "s,^\\.,  $dir,"
43             done
44             set -f glob
45         fi;;
46 esac