1#!/bin/sh 2# 3# 4 5# PROVIDE: cleanvar 6# REQUIRE: var 7 8. /etc/rc.subr 9 10name="cleanvar" 11desc="Purge /var directory" 12rcvar="cleanvar_enable" 13 14start_precmd="${name}_prestart" 15start_cmd="${name}_start" 16stop_cmd=":" 17 18extra_commands="reload" 19reload_cmd="${name}_start" 20 21cleanvar_prestart() 22{ 23 # These files must be removed only the first time this script is run 24 # on boot. 25 # 26 rm -f /var/run/clean_var /var/spool/lock/clean_var 27} 28 29cleanvar_start() 30{ 31 if [ -d /var/run -a ! -f /var/run/clean_var ]; then 32 # Skip over logging sockets 33 find -x /var/run \( -type f -or -type s ! -name log -and ! -name logpriv \) -delete 34 >/var/run/clean_var 35 fi 36 if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then 37 find -x /var/spool/lock -type f -delete 38 >/var/spool/lock/clean_var 39 fi 40 if [ -d /var/spool/uucp/.Temp ]; then 41 find -x /var/spool/uucp/.Temp -delete 42 fi 43} 44 45load_rc_config $name 46run_rc_command "$1" 47