Home | History | Annotate | Line # | Download | only in rc.d
accounting revision 1.7
      1 #!/bin/sh
      2 #
      3 # $NetBSD: accounting,v 1.7 2002/03/22 04:33:57 thorpej Exp $
      4 #
      5 
      6 # PROVIDE: accounting
      7 # REQUIRE: mountall
      8 # BEFORE:  DAEMON
      9 
     10 . /etc/rc.subr
     11 
     12 name="accounting"
     13 rcvar=$name
     14 accounting_command="/usr/sbin/accton"
     15 accounting_file="/var/account/acct"
     16 start_cmd="accounting_start"
     17 stop_cmd="accounting_stop"
     18 
     19 accounting_start()
     20 {
     21 	if [ ! -f ${accounting_file} ]; then
     22 		echo "Creating accounting file ${accounting_file}"
     23 		( umask 022 ; > ${accounting_file} )
     24 	fi
     25 	echo "Turning on accounting."
     26 	${accounting_command} ${accounting_file}
     27 }
     28 
     29 accounting_stop()
     30 {
     31 	echo "Turning off accounting."
     32 	${accounting_command}
     33 }
     34 
     35 load_rc_config $name
     36 run_rc_command "$1"
     37