get mxge to build, stage 29/many
[dragonfly.git] / etc / rc.d / cleartmp
blobec2237864e81b548bafe5e20ef7d947eac75eec5
1 #!/bin/sh
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 $
5 # $DragonFly: src/etc/rc.d/cleartmp,v 1.7 2008/11/22 18:36:18 swildner Exp $
8 # PROVIDE: cleartmp
9 # REQUIRE: mountcritremote
10 # BEFORE: DAEMON
12 . /etc/rc.subr
14 name="cleartmp"
15 rcvar=`set_rcvar clear_tmp`
16 start_cmd="cleartmp_start"
17 stop_cmd=":"
19 cleartmp_start()
21 echo "Clearing /tmp."
23 # Prune quickly with one rm, then use find to clean up
24 # the rest. Exceptions are lost+found/ (which is preserved
25 # but its contents are removed), quota.{group,user}, and
26 # snapshots/ (left untouched). This is not needed with mfs
27 # /tmp, but doesn't hurt anything.
29 (cd /tmp && rm -rf [a-km-prt-zA-Z]* &&
30 find -x . ! -name . ! -name lost+found \
31 ! -name snapshots ! -path "./snapshots/*" \
32 ! -name quota.user ! -name quota.group \
33 -exec rm -rf -- {} \; -type d -prune)
35 # Remove X lock files, since they will prevent you from
36 # restarting X
38 rm -f /tmp/.X*-lock
39 rm -fr /tmp/.X11-unix
40 mkdir -m 1777 /tmp/.X11-unix
43 load_rc_config $name
44 run_rc_command "$1"