3 # $NetBSD: accounting,v 1.7 2002/03/22 04:33:57 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/accounting,v 1.4 2002/10/12 10:31:31 schweikh Exp $
5 # $DragonFly: src/etc/rc.d/accounting,v 1.2 2003/11/19 10:32:45 eirikn Exp $
11 # KEYWORD: DragonFly FreeBSD NetBSD
17 accounting_command="/usr/sbin/accton"
18 accounting_file="/var/account/acct"
19 start_cmd="accounting_start"
20 stop_cmd="accounting_stop"
26 _dir=`dirname "$accounting_file"`
27 if [ ! -d `dirname "$_dir"` ]; then
28 if ! mkdir -p "$_dir"; then
29 warn "Could not create $_dir."
33 if [ ! -e "$accounting_file" ]; then
34 touch "$accounting_file"
38 _dir=`dirname "$accounting_file"`
39 if [ ! -d `dirname "$_dir"` ]; then
40 if ! mkdir -p "$_dir"; then
41 warn "Could not create $_dir."
45 if [ ! -e "$accounting_file" ]; then
46 touch "$accounting_file"
55 if [ ! -f ${accounting_file} ]; then
56 echo "Creating accounting file ${accounting_file}"
57 ( umask 022 ; > ${accounting_file} )
59 echo "Turning on accounting."
60 ${accounting_command} ${accounting_file}
65 echo "Turning off accounting."