3 # $NetBSD: cleartmp,v 1.4 2002/03/22 04:33:58 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/cleartmp,v 1.4 2002/10/12 10:31:31 schweikh Exp $
14 rcvar
=`set_rcvar clear_tmp`
15 start_cmd
="cleartmp_start"
22 # Prune quickly with one rm, then use find to clean up
23 # the rest. Exceptions are lost+found/ (which is preserved
24 # but its contents are removed), quota.{group,user}, and
25 # snapshots/ (left untouched). This is not needed with mfs
26 # /tmp, but doesn't hurt anything.
28 (cd /tmp
&& rm -rf [a-km-prt-zA-Z
]* &&
29 find -x .
! -name .
! -name lost
+found \
30 ! -name snapshots
! -path "./snapshots/*" \
31 ! -name quota.user
! -name quota.group \
32 -exec rm -rf -- {} \
; -type d
-prune)
34 # Remove X lock files, since they will prevent you from restarting X.
35 rm -rf /tmp
/.X
*-lock /tmp
/.X11-unix
36 mkdir
-m 1777 /tmp
/.X11-unix