Home | History | Annotate | Line # | Download | only in rc.d
      1  1.1     lukem #!/bin/sh
      2  1.1     lukem #
      3  1.9      elad # $NetBSD: accounting,v 1.9 2006/10/08 18:08:39 elad 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.9      elad # KEYWORD: shutdown
     10  1.1     lukem 
     11  1.8   mycroft $_rc_subr_loaded . /etc/rc.subr
     12  1.1     lukem 
     13  1.1     lukem name="accounting"
     14  1.3     lukem rcvar=$name
     15  1.5     lukem accounting_command="/usr/sbin/accton"
     16  1.5     lukem accounting_file="/var/account/acct"
     17  1.1     lukem start_cmd="accounting_start"
     18  1.1     lukem stop_cmd="accounting_stop"
     19  1.1     lukem 
     20  1.1     lukem accounting_start()
     21  1.1     lukem {
     22  1.5     lukem 	if [ ! -f ${accounting_file} ]; then
     23  1.5     lukem 		echo "Creating accounting file ${accounting_file}"
     24  1.6     lukem 		( umask 022 ; > ${accounting_file} )
     25  1.1     lukem 	fi
     26  1.4  jdolecek 	echo "Turning on accounting."
     27  1.5     lukem 	${accounting_command} ${accounting_file}
     28  1.1     lukem }
     29  1.1     lukem 
     30  1.1     lukem accounting_stop()
     31  1.1     lukem {
     32  1.1     lukem 	echo "Turning off accounting."
     33  1.5     lukem 	${accounting_command}
     34  1.1     lukem }
     35  1.1     lukem 
     36  1.2     lukem load_rc_config $name
     37  1.1     lukem run_rc_command "$1"
     38