accounting revision 126744
1#!/bin/sh 2# 3# $NetBSD: accounting,v 1.7 2002/03/22 04:33:57 thorpej Exp $ 4# $FreeBSD: head/etc/rc.d/accounting 126744 2004-03-08 12:25:05Z pjd $ 5# 6 7# PROVIDE: accounting 8# REQUIRE: mountcritremote 9# BEFORE: DAEMON 10# KEYWORD: FreeBSD nojail 11 12. /etc/rc.subr 13 14name="accounting" 15rcvar=`set_rcvar` 16accounting_command="/usr/sbin/accton" 17accounting_file="/var/account/acct" 18start_cmd="accounting_start" 19stop_cmd="accounting_stop" 20 21accounting_start() 22{ 23 _dir=`dirname "$accounting_file"` 24 if [ ! -d `dirname "$_dir"` ]; then 25 if ! mkdir -p "$_dir"; then 26 warn "Could not create $_dir." 27 return 1 28 fi 29 fi 30 if [ ! -e "$accounting_file" ]; then 31 touch "$accounting_file" 32 fi 33 34 if [ ! -f ${accounting_file} ]; then 35 echo "Creating accounting file ${accounting_file}" 36 ( umask 022 ; > ${accounting_file} ) 37 fi 38 echo "Turning on accounting." 39 ${accounting_command} ${accounting_file} 40} 41 42accounting_stop() 43{ 44 echo "Turning off accounting." 45 ${accounting_command} 46} 47 48load_rc_config $name 49run_rc_command "$1" 50