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