Date: Fri, 09 Jun 2000 00:09:10 +0100 From: Brian Somers <brian@Awfulhak.org> To: Kris Kennaway <kris@FreeBSD.ORG> Cc: Brian Somers <brian@Awfulhak.org>, Clive Lin <clive@CirX.ORG>, Valentin Nechayev <netch@lucky.net>, Brian Somers <brian@FreeBSD.ORG>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, brian@hak.lan.awfulhak.org, freebsd-audit@FreeBSD.ORG Subject: Request for review (was: cvs commit: src/etc/periodic/daily 110.clean-tmps ) Message-ID: <200006082309.AAA35033@hak.lan.Awfulhak.org> In-Reply-To: Message from Kris Kennaway <kris@FreeBSD.org> of "Thu, 08 Jun 2000 14:19:45 PDT." <Pine.BSF.4.21.0006081417260.20785-100000@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multipart MIME message.
--==_Exmh_7420186240
Content-Type: text/plain; charset=us-ascii
> On Thu, 8 Jun 2000, Brian Somers wrote:
>
> > With this in defaults/rc.conf:
> >
> > clear_daily_ignore=".X*-lock quota.user quota.group" # Don't delete these
> > clear_daily_dirs="/tmp /var/tmp /compat/linux/tmp" # Delete stuff here
> > clear_daily_days= # Older than this (3?)
>
> I'd also suggest having the list of removed files added to the daily
> sysadmin mailing. I've been bitten by something like this before - a
> daemon was periodically dying and I finally figured out it was because a
> long-lived tempfile was being reaped. A daily report of files removed
> would show you whether you might need to add some more files to the ignore
> list.
Ok, here's the latest draft. Please let me know if there are any
problems. I've cc'd freebsd-audit at Robert W's request, so please
also keep the cc list in mind when replying.
> Kris
>
> --
> In God we Trust -- all others must submit an X.509 certificate.
> -- Charles Forsythe <forsythe@alum.mit.edu>
--==_Exmh_7420186240
Content-Type: application/x-patch ; name="rc.conf.5.patch"
Content-Description: rc.conf.5.patch
Content-Disposition: attachment; filename="rc.conf.5.patch"
Index: rc.conf.5
===================================================================
RCS file: /home/ncvs/src/share/man/man5/rc.conf.5,v
retrieving revision 1.71
diff -u -r1.71 rc.conf.5
--- rc.conf.5 2000/05/09 08:09:31 1.71
+++ rc.conf.5 2000/06/08 23:01:53
@@ -1153,6 +1153,30 @@
if you want
.Pa /tmp
to be cleaned at startup.
+.It Ar clear_daily_enable
+(bool) Set to
+.Ar YES
+if you want to clear temporary directories daily.
+.It Ar clear_daily_dirs
+(str) Set to the list of directories to clear if
+.Ar clear_daily_enable
+is set to
+.Ar YES .
+.It Ar clear_daily_days
+(int) When
+.Ar clear_daily_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 Ar clear_daily_ignore
+(str) Set to the list of files that should not be deleted when
+.Ar clear_daily_enable
+is set to
+.Ar YES .
+Wild cards are permitted.
+.It Ar clear_daily_verbose
+(bool) Set to
+.Ar YES
+if you want the removed files to be reported in your daily output.
.It Ar ldconfig_paths
(str) Set to the list of shared library paths to use with
.Xr ldconfig 8 .
--==_Exmh_7420186240
Content-Type: text/plain ; name="rc.conf.add"; charset=us-ascii
Content-Description: rc.conf.add
Content-Disposition: attachment; filename="rc.conf.add"
clear_daily_enable="NO" # Delete stuff daily
clear_daily_dirs="/tmp /compat/linux/tmp" # Delete under here
clear_daily_days="3" # If older than this
clear_daily_ignore=".X*-lock quota.user quota.group" # Don't delete these
clear_daily_verbose="YES" # Mention files deleted
--==_Exmh_7420186240
Content-Type: text/plain ; name="110.clean-tmps"; charset=us-ascii
Content-Description: 110.clean-tmps
Content-Disposition: attachment; filename="110.clean-tmps"
#!/bin/sh
#
# $FreeBSD: src/etc/periodic/daily/110.clean-tmps,v 1.7 2000/06/08 08:48:15 brian Exp $
#
# Perform temporary directory cleaning so that long-lived systems
# don't end up with excessively old files there. If /var/tmp and
# /tmp are symlinked together, only one of the below will actually
# run.
#
# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
case "$clear_daily_enable" in
[Yy][Ee][Ss])
if [ -n "$clear_daily_days" ]
then
echo ""
echo "Removing old temporary files:"
set -f noglob
args="-atime +$clear_daily_days -mtime +$clear_daily_days"
[ -n "$clear_daily_ignore" ] &&
args="$args "`echo " ${clear_daily_ignore% }" |
sed 's/[ ][ ]*/ ! -name /g'`
case "$clear_daily_verbose" in
[Yy][Ee][Ss])
print=-print;;
*)
print=;;
esac
for dir in $clear_daily_dirs
do
[ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && {
find -d . -type f $args -delete $print
find -d . ! -name . -type d -mtime +$clear_daily_days \
-delete $print
} | sed "s,^\\., $dir,"
done
set -f glob
fi;;
esac
--==_Exmh_7420186240--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200006082309.AAA35033>
