Home | History | Annotate | Line # | Download | only in rc.d
cleartmp revision 1.7
      1 #!/bin/sh
      2 #
      3 # $NetBSD: cleartmp,v 1.7 2006/10/07 23:08:03 elad Exp $
      4 #
      5 
      6 # PROVIDE: cleartmp
      7 # REQUIRE: mountall
      8 # BEFORE:  DAEMON
      9 
     10 $_rc_subr_loaded . /etc/rc.subr
     11 
     12 name="cleartmp"
     13 rcvar="clear_tmp"
     14 start_cmd="cleartmp_start"
     15 stop_cmd=":"
     16 
     17 cleartmp_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 
     30 load_rc_config $name
     31 run_rc_command "$1"
     32