2000-03-10 14:53:23 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2001-04-30 03:57:25 +04:00
|
|
|
# $NetBSD: accounting,v 1.6 2001/04/29 23:57:25 lukem Exp $
|
2000-03-10 14:53:23 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: accounting
|
|
|
|
# REQUIRE: mountall
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="accounting"
|
2000-09-19 17:04:38 +04:00
|
|
|
rcvar=$name
|
2001-04-26 03:20:15 +04:00
|
|
|
accounting_command="/usr/sbin/accton"
|
|
|
|
accounting_file="/var/account/acct"
|
2000-03-10 14:53:23 +03:00
|
|
|
start_cmd="accounting_start"
|
|
|
|
stop_cmd="accounting_stop"
|
|
|
|
|
|
|
|
accounting_start()
|
|
|
|
{
|
2001-04-26 03:20:15 +04:00
|
|
|
if [ ! -f ${accounting_file} ]; then
|
|
|
|
echo "Creating accounting file ${accounting_file}"
|
2001-04-30 03:57:25 +04:00
|
|
|
( umask 022 ; > ${accounting_file} )
|
2000-03-10 14:53:23 +03:00
|
|
|
fi
|
2001-04-25 15:48:22 +04:00
|
|
|
echo "Turning on accounting."
|
2001-04-26 03:20:15 +04:00
|
|
|
${accounting_command} ${accounting_file}
|
2000-03-10 14:53:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
accounting_stop()
|
|
|
|
{
|
|
|
|
echo "Turning off accounting."
|
2001-04-26 03:20:15 +04:00
|
|
|
${accounting_command}
|
2000-03-10 14:53:23 +03:00
|
|
|
}
|
|
|
|
|
2000-05-13 12:45:06 +04:00
|
|
|
load_rc_config $name
|
2000-03-10 14:53:23 +03:00
|
|
|
run_rc_command "$1"
|