--- etc/periodic/daily/110.clean-tmps Thu Jul 19 14:08:24 2001 +++ etc/periodic/daily/110.clean-tmps Tue Sep 11 09:16:46 2001 @@ -22,11 +22,21 @@ '$daily_clean_tmps_days is not' rc=2 else + clean_ssh_agent=NO + case "$daily_clean_tmps_ssh_enable" in + [Yy][Ee][Ss]) + clean_ssh_agent=YES + if [ -z "$daily_clean_tmps_ssh_days" ] + then + daily_clean_tmps_ssh_days=$daily_clean_tmps_days + fi + esac echo "" echo "Removing old temporary files:" set -f noglob args="-atime +$daily_clean_tmps_days -mtime +$daily_clean_tmps_days" + ssh_args="-atime +$daily_clean_tmps_ssh_days -mtime +$daily_clean_tmps_ssh_days" [ -n "$daily_clean_tmps_ignore" ] && args="$args "`echo " ${daily_clean_tmps_ignore% }" | sed 's/[ ][ ]*/ ! -name /g'` @@ -36,18 +46,32 @@ *) print=;; esac + [ -z "$daily_clean_tmps_dir_days" ] && daily_clean_tmps_dir_days=$daily_clean_tmps_days rc=$(for dir in $daily_clean_tmps_dirs do [ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && { find -d . -type f $args -delete $print find -d . ! -name . -type d -empty -mtime \ - +$daily_clean_tmps_days -delete $print - } | sed "s,^\\., $dir," + +$daily_clean_tmps_dir_days -delete $print + if [ "$clean_ssh_agent" = "YES" ] + then + set +f noglob + ssh_dirs=$(echo ssh-*) + set -f noglob + if [ -n "$ssh_dirs" -a "$ssh_dirs" != "ssh-*" ] + then + find -d $ssh_dirs -depth \ + \( -type s $ssh_args -name agent.\[\0-9]\* \ + -delete $print \) -o \ + \( -type d -empty -delete $print \); + fi + fi + } | sed "s,^\\., $dir,; s,^\\(ssh-[^ \/]*\\), $dir/\\1,;" done | tee /dev/stderr | wc -l) [ -z "$print" ] && rc=0 [ $rc -gt 1 ] && rc=1 - set -f glob + set +f noglob fi;; *) rc=0;; --- etc/defaults/periodic.conf Thu Jul 26 04:37:11 2001 +++ etc/defaults/periodic.conf Tue Sep 11 13:21:49 2001 @@ -42,8 +42,11 @@ daily_clean_tmps_enable="NO" # Delete stuff daily daily_clean_tmps_dirs="/tmp" # Delete under here daily_clean_tmps_days="3" # If not accessed for +daily_clean_tmps_dir_days="3" # If dir not accessed daily_clean_tmps_ignore=".X*-lock quota.user quota.group" # Don't delete these daily_clean_tmps_verbose="YES" # Mention files deleted +daily_clean_tmps_ssh_enable="NO" # Delete ssh agent stuff +daily_clean_tmps_ssh_days="3" # If not accessed for # 120.clean-preserve daily_clean_preserve_enable="YES" # Delete files daily --- share/man/man5/periodic.conf.5 Sat Jul 28 22:10:19 2001 +++ share/man/man5/periodic.conf.5 Sat Jul 28 23:57:56 2001 @@ -177,6 +177,11 @@ .Va daily_clean_tmps_enable is set, this must also be set to the number of days old that a file's access and modification times must be before it's deleted. +.It Va daily_clean_tmps_dir_days +.Pq Vt num +If you want a different amount of time after which directories are deleted +you can set this variable. Its default is the value of +.Va daily_clean_tmps_days. .It Va daily_clean_tmps_ignore .Pq Vt str Set to the list of files that should not be deleted when @@ -189,6 +194,17 @@ Set to .Dq YES if you want the removed files to be reported in your daily output. +.It Va daily_clean_tmps_ssh_enable +.Pq Vt bool +Set to +.Dq YES +if you want to clear sockets of ssh-agent in your temporary directories daily. +.It Va daily_clean_tmps_ssh_days +.Pq Vt num +When +.Va daily_clean_tmps_ssh_enable +is set, this must also be set to the number of days old that a ssh-agent socket +access and modification times must be before it's deleted. .It Va daily_clean_preserve_enable .Pq Vt bool Set to