1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Add a few hints about the cleaning policy of /tmp, including an example

(commented out) for how to purge it regularly.
This commit is contained in:
Joerg Wunsch 1996-06-22 13:05:20 +00:00
parent ce51cf0392
commit 3be34f8291
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=16588
2 changed files with 42 additions and 1 deletions

View File

@ -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

19
etc/rc
View File

@ -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}