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