Deleted Added
full compact
cleartmp (78345) cleartmp (98184)
1#!/bin/sh
2#
1#!/bin/sh
2#
3# $NetBSD: cleartmp,v 1.2 2000/05/13 08:45:06 lukem Exp $
3# $NetBSD: cleartmp,v 1.4 2002/03/22 04:33:58 thorpej Exp $
4# $FreeBSD: head/etc/rc.d/cleartmp 98184 2002-06-13 22:14:37Z gordon $
4#
5
6# PROVIDE: cleartmp
7# REQUIRE: mountall
5#
6
7# PROVIDE: cleartmp
8# REQUIRE: mountall
9# BEFORE: DAEMON
10# KEYWORD: FreeBSD NetBSD
8
9. /etc/rc.subr
10
11name="cleartmp"
11
12. /etc/rc.subr
13
14name="cleartmp"
12rcvar="clear_tmp"
15rcvar=`set_rcvar clear_tmp`
13start_cmd="cleartmp_start"
14stop_cmd=":"
15
16cleartmp_start()
17{
18 echo "Clearing /tmp."
19 #
20 # Prune quickly with one rm, then use find to clean up
21 # /tmp/[lq]* (this is not needed with mfs /tmp, but
22 # doesn't hurt anything).
23 #
24 (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
25 find -x . ! -name . ! -name lost+found ! -name quota.user \
26 ! -name quota.group -exec rm -rf -- {} \; -type d -prune)
16start_cmd="cleartmp_start"
17stop_cmd=":"
18
19cleartmp_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 case `${CMD_OSTYPE}` in
32 FreeBSD)
33 # Remove X lock files, since they will prevent you from
34 # restarting X
35 #
36 rm -f /tmp/.X*-lock
37 rm -fr /tmp/.X11-unix
38 mkdir -m 1777 /tmp/.X11-unix
39 ;;
40 NetBSD)
41 ;;
42 esac
27}
28
29load_rc_config $name
30run_rc_command "$1"
43}
44
45load_rc_config $name
46run_rc_command "$1"