cleartmp revision 1.3
1#!/bin/sh
2#
3# $NetBSD: cleartmp,v 1.3 2000/09/19 13:04:38 lukem Exp $
4#
5
6# PROVIDE: cleartmp
7# REQUIRE: mountall
8
9. /etc/rc.subr
10
11name="cleartmp"
12rcvar="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)
27}
28
29load_rc_config $name
30run_rc_command "$1"
31