xref: /netbsd/etc/rc.d/cleartmp (revision bf9ec67e)
1#!/bin/sh
2#
3# $NetBSD: cleartmp,v 1.4 2002/03/22 04:33:58 thorpej Exp $
4#
5
6# PROVIDE: cleartmp
7# REQUIRE: mountall
8# BEFORE:  DAEMON
9
10. /etc/rc.subr
11
12name="cleartmp"
13rcvar="clear_tmp"
14start_cmd="cleartmp_start"
15stop_cmd=":"
16
17cleartmp_start()
18{
19	echo "Clearing /tmp."
20	#
21	#	Prune quickly with one rm, then use find to clean up
22	#	/tmp/[lq]* (this is not needed with mfs /tmp, but
23	#	doesn't hurt anything).
24	#
25	(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
26	    find -x . ! -name . ! -name lost+found ! -name quota.user \
27		! -name quota.group -exec rm -rf -- {} \; -type d -prune)
28}
29
30load_rc_config $name
31run_rc_command "$1"
32