Raise WARNS to 6 and fix resulting warnings.
[dragonfly.git] / etc / rc.d / accounting
blobdfd448511c3890bcba140dc390a7f51481b93490
1 #!/bin/sh
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.5 2005/11/19 21:47:32 swildner Exp $
8 # PROVIDE: accounting
9 # REQUIRE: mountcritremote
10 # BEFORE: DAEMON
12 . /etc/rc.subr
14 name="accounting"
15 rcvar=`set_rcvar`
16 accounting_command="/usr/sbin/accton"
17 accounting_file="/var/account/acct"
18 start_cmd="accounting_start"
19 stop_cmd="accounting_stop"
21 accounting_start()
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
30 if [ ! -e "$accounting_file" ]; then
31 touch "$accounting_file"
33 echo "Turning on accounting."
34 ${accounting_command} ${accounting_file}
37 accounting_stop()
39 echo "Turning off accounting."
40 ${accounting_command}
43 load_rc_config $name
44 run_rc_command "$1"