From 3be34f829186926c2e4eee0d822c6b64198d873c Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sat, 22 Jun 1996 13:05:20 +0000 Subject: [PATCH] Add a few hints about the cleaning policy of /tmp, including an example (commented out) for how to purge it regularly. --- etc/daily | 24 ++++++++++++++++++++++++ etc/rc | 19 ++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/etc/daily b/etc/daily index 423063e5c29c..25cc17e6f0b7 100644 --- a/etc/daily +++ b/etc/daily @@ -30,6 +30,30 @@ cd /tmp # -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \ # -a -atime +3 -exec rm -f -- {} \; # +# +# The same security hole. Purge the temp directories from unused stuff. +# Note that we must not accidentally clean the X11 lock files. +# +# Use at your own risk, but for a long-living system, this might come +# more useful than the boot-time cleaning of /tmp. If /var/tmp and +# /tmp are symlinked together, only one of the below will actually +# run. +# +# if [ -d /tmp ]; then +# cd /tmp && { +# find . -type f -atime +3 -ctime +3 ! -name '.X*-lock' -exec rm -f -- {} \; +# find -d . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \ +# >/dev/null 2>&1; } +# fi +# +# if [ -d /var/tmp ]; then +# cd /var/tmp && { +# find . ! -name . -atime +7 -ctime +3 -exec rm -f -- {} \; +# find -d . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \ +# >/dev/null 2>&1; } +# fi +# +# # remove system messages older than 21 days msgs -c diff --git a/etc/rc b/etc/rc index c53d96f54e1e..45678ad4cb98 100644 --- a/etc/rc +++ b/etc/rc @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: rc,v 1.90 1996/05/19 22:30:26 ache Exp $ +# $Id: rc,v 1.91 1996/06/15 17:04:48 jkh Exp $ # From: @(#)rc 5.27 (Berkeley) 6/5/91 # System startup script run by init on autoboot @@ -118,6 +118,15 @@ rm -rf /var/spool/uucp/.Temp/* rm -f /dev/log (cd /var/run && { cp /dev/null utmp; chmod 644 utmp; }) +# +# Clearing /tmp at boot-time is essentially stupid, but seems to have +# a long tradition. It doesn't help in any way for long-living systems, +# and it might accidentally clobber files you would rather like to have +# preserved after a crash (if not using mfs /tmp anyway). +# +# See also the commented out example of another cleanup policy in +# /etc/daily. +# echo clearing /tmp # prune quickly with one rm, then use find to clean up /tmp/[lq]* @@ -125,6 +134,14 @@ echo clearing /tmp (cd /tmp && rm -rf [a-km-pr-zA-Z]* && find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) +# The above is even more stupid since it prevents you from restarting +# X11 after a system crash. If you disable the above, make sure to +# uncomment the line below. +# +# clean up leftover X lock files and local connection sockets +#rm -f /tmp/.X*-lock /tmp/.X11-unix/* + + # enable dumpdev so that savecore can see it if [ "X${dumpdev}" != X"NO" ]; then dumpon ${dumpdev}