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