Resurrect a modified version of the /tmp clearing code from rev 1.119.

Enable this by setting clear_tmp_enable in rc.conf to YES.  Beware
there can be serious side-effects of enabling this, so use at you own
risk.

PR:		misc/4982, misc/5054
This commit is contained in:
Steve Price 1997-11-16 12:52:17 +00:00
parent c2fc1574ce
commit 390200d554
2 changed files with 24 additions and 2 deletions

23
etc/rc
View File

@ -1,5 +1,5 @@
#!/bin/sh
# $Id: rc,v 1.137 1997/09/13 21:07:12 brian Exp $
# $Id: rc,v 1.138 1997/09/21 16:09:47 joerg Exp $
# From: @(#)rc 5.27 (Berkeley) 6/5/91
# System startup script run by init on autoboot
@ -133,6 +133,27 @@ rm -f /var/spool/lock/*
rm -rf /var/spool/uucp/.Temp/*
(cd /var/run && { cp /dev/null utmp; chmod 644 utmp; })
#
# Clearing /tmp at boot-time 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 example of another cleanup policy in /etc/periodic/daily.
#
if [ "X${clear_tmp_enable}" = X"YES" ]; then
echo clearing /tmp
# prune quickly with one rm, then use find to clean up /tmp/[lq]*
# (not needed with mfs /tmp, but doesn't hurt there...)
(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)
# Also remove X lock files since it will prevent you from
# restarting X11 after a system crash.
rm -f /tmp/.X*-lock /tmp/.X11-unix/*
fi
# enable dumpdev so that savecore can see it
# /var/crash should be a directory or a symbolic link
# to the crash directory if core dumps are to be saved.

View File

@ -6,7 +6,7 @@
#
# All arguments must be in double or single quotes.
#
# $Id: rc.conf,v 1.32 1997/10/31 01:58:53 jdp Exp $
# $Id: rc.conf,v 1.33 1997/11/07 20:45:36 sef Exp $
##############################################################
### Important initial Boot-time options #####################
@ -135,6 +135,7 @@ accounting_enable="NO" # Turn on process accounting (or NO).
ibcs2_enable="NO" # Ibcs2 (SCO) emulation loaded at startup (or NO).
linux_enable="NO" # Linux emulation loaded at startup (or NO).
rand_irqs="NO" # Stir the entropy pool (like "5 11" or NO).
clear_tmp_enable="NO" # Clear /tmp at startup.
##############################################################
### Allow local configuration override at the very end here ##