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