cleartmp revision 1.2
1#!/bin/sh
2#
3# $NetBSD: cleartmp,v 1.2 2000/05/13 08:45:06 lukem Exp $
4#
5
6# PROVIDE: cleartmp
7# REQUIRE: mountall
8
9. /etc/rc.subr
10
11name="cleartmp"
12start_cmd="cleartmp_start"
13start_precmd="checkyesno clear_tmp"
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