7 # REQUIRE: mountcritremote
14 rcvar="accounting_enable"
15 accounting_command="/usr/sbin/accton"
16 accounting_file="/var/account/acct"
18 extra_commands="rotate_log"
20 start_cmd="accounting_start"
21 stop_cmd="accounting_stop"
22 rotate_log_cmd="accounting_rotate_log"
28 _dir="${accounting_file%/*}"
29 if [ ! -d "$_dir" ]; then
30 if ! mkdir -p "$_dir"; then
31 err 1 "Could not create $_dir."
35 if [ ! -e "$accounting_file" ]; then
36 echo -n "Creating accounting file ${accounting_file}"
37 touch "$accounting_file"
40 chmod 644 "$accounting_file"
42 echo "Turning on accounting."
43 ${accounting_command} ${accounting_file}
48 echo "Turning off accounting."
52 accounting_rotate_log()
56 _dir="${accounting_file%/*}"
59 if checkyesno accounting_enable; then
60 _file=`mktemp newacct-XXXXX`
62 ${accounting_command} ${_dir}/${_file}
65 mv ${accounting_file} ${accounting_file}.0
67 if checkyesno accounting_enable; then
68 ln $_file ${accounting_file##*/}
69 ${accounting_command} ${accounting_file}