accounting revision 104980
1132451Sroberto#!/bin/sh 2132451Sroberto# 3285612Sdelphij# $NetBSD: accounting,v 1.7 2002/03/22 04:33:57 thorpej Exp $ 4285612Sdelphij# $FreeBSD: head/etc/rc.d/accounting 104980 2002-10-12 10:31:31Z schweikh $ 5285612Sdelphij# 6285612Sdelphij 7285612Sdelphij# PROVIDE: accounting 8285612Sdelphij# REQUIRE: mountall 9285612Sdelphij# BEFORE: DAEMON 10285612Sdelphij# KEYWORD: FreeBSD NetBSD 11285612Sdelphij 12285612Sdelphij. /etc/rc.subr 13285612Sdelphij 14285612Sdelphijname="accounting" 15285612Sdelphijrcvar=`set_rcvar` 16285612Sdelphijaccounting_command="/usr/sbin/accton" 17285612Sdelphijaccounting_file="/var/account/acct" 18285612Sdelphijstart_cmd="accounting_start" 19285612Sdelphijstop_cmd="accounting_stop" 20285612Sdelphij 21285612Sdelphijaccounting_start() 22285612Sdelphij{ 23285612Sdelphij case ${OSTYPE} in 24285612Sdelphij FreeBSD) 25285612Sdelphij _dir=`dirname "$accounting_file"` 26285612Sdelphij if [ ! -d `dirname "$_dir"` ]; then 27285612Sdelphij if ! mkdir -p "$_dir"; then 28285612Sdelphij warn "Could not create $_dir." 29285612Sdelphij return 1 30285612Sdelphij fi 31285612Sdelphij fi 32285612Sdelphij 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} ) 43 fi 44 echo "Turning on accounting." 45 ${accounting_command} ${accounting_file} 46} 47 48accounting_stop() 49{ 50 echo "Turning off accounting." 51 ${accounting_command} 52} 53 54load_rc_config $name 55run_rc_command "$1" 56