[BACK]Return to cleartmp CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc / rc.d

File: [cvs.NetBSD.org] / src / etc / rc.d / cleartmp (download)

Revision 1.7, Sat Oct 7 23:08:03 2006 UTC (13 years, 2 months ago) by elad
Branch: MAIN
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4
Changes since 1.6: +4 -5 lines

Back out previous. This was a dup of PR/29144 that was fixed differently.

Thanks to pavel@ for pointing out, okay oster@.

#!/bin/sh
#
# $NetBSD: cleartmp,v 1.7 2006/10/07 23:08:03 elad Exp $
#

# PROVIDE: cleartmp
# REQUIRE: mountall
# BEFORE:  DAEMON

$_rc_subr_loaded . /etc/rc.subr

name="cleartmp"
rcvar="clear_tmp"
start_cmd="cleartmp_start"
stop_cmd=":"

cleartmp_start()
{
	echo "Clearing /tmp."
	#
	#	Prune quickly with one rm, then use find to clean up
	#	/tmp/[lq]* (this is not needed with mfs /tmp, but
	#	doesn't hurt anything).
	#
	(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
	    find -x . ! -name . ! -name lost+found ! -name quota.user \
		! -name quota.group -exec rm -rf -- {} \; -type d -prune)
}

load_rc_config $name
run_rc_command "$1"