]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.d/cleartmp
This commit was generated by cvs2svn to compensate for changes in r136136,
[FreeBSD/FreeBSD.git] / etc / rc.d / cleartmp
1 #!/bin/sh
2 #
3 # $NetBSD: cleartmp,v 1.4 2002/03/22 04:33:58 thorpej Exp $
4 # $FreeBSD$
5 #
6
7 # PROVIDE: cleartmp
8 # REQUIRE: mountcritremote tmp
9 # BEFORE: DAEMON
10 # KEYWORD: FreeBSD
11
12 . /etc/rc.subr
13
14 name="cleartmp"
15 rcvar=`set_rcvar clear_tmp`
16 start_cmd="cleartmp_start"
17 stop_cmd=":"
18
19 cleartmp_start()
20 {
21         echo "Clearing /tmp."
22         #
23         #       Prune quickly with one rm, then use find to clean up
24         #       /tmp/[lq]* (this is not needed with mfs /tmp, but
25         #       doesn't hurt anything).
26         #
27         (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
28             find -x . ! -name . ! -name lost+found ! -name quota.user \
29                 ! -name quota.group -exec rm -rf -- {} \; -type d -prune)
30 }
31
32 load_rc_config $name
33 run_rc_command "$1"
34
35 # Remove X lock files, since they will prevent you from
36 # restarting X
37 #
38 rm -f /tmp/.X[0-9]-lock
39 rm -fr /tmp/.X11-unix
40 mkdir -m 1777 /tmp/.X11-unix