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