summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1997-11-16 12:52:17 +0000
committersteve <steve@FreeBSD.org>1997-11-16 12:52:17 +0000
commit2c2d3b03307816140f591feb46251497dfdddf8b (patch)
tree9db7369d2dfd244b9f1117d6461c8e0bbe732b0b /etc
parentd2f586c7135e2955b23ebb8469c47ce81746865b (diff)
downloadFreeBSD-src-2c2d3b03307816140f591feb46251497dfdddf8b.zip
FreeBSD-src-2c2d3b03307816140f591feb46251497dfdddf8b.tar.gz
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
Diffstat (limited to 'etc')
-rw-r--r--etc/rc23
-rw-r--r--etc/rc.conf3
2 files changed, 24 insertions, 2 deletions
diff --git a/etc/rc b/etc/rc
index 3433643..de3c127 100644
--- a/etc/rc
+++ b/etc/rc
@@ -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.
diff --git a/etc/rc.conf b/etc/rc.conf
index 6c0c8c5..5a9e70a 100644
--- a/etc/rc.conf
+++ b/etc/rc.conf
@@ -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 ##
OpenPOWER on IntegriCloud