Subject: misc/12735: etc/rc.d/accounting works only if someone creates /var/accounting/acct
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 04/24/2001 20:10:40
>Number:         12735
>Category:       misc
>Synopsis:       Too much manual effort required to enable accounting
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 24 06:11:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Robert Elz
>Release:        <NetBSD-current source date>
>Organization:
	University of Melbourne
>Environment:
	
System: NetBSD brandenburg.cs.mu.OZ.AU 1.5_BETA NetBSD 1.5_BETA (BRANDENBURG) #4: Mon Dec 4 17:01:12 EST 2000 kre@brandenburg.cs.mu.OZ.AU:/usr/src/sys/arch/i386/compile/BRANDENBURG i386

System: NetBSD kre.coe.psu.ac.th 1.5U NetBSD 1.5U (KRE) #2: Tue Apr 24 13:57:55 ICT 2001     kre@kre.coe.psu.ac.th:/usr/obj/sys/compile/KRE i386


>Description:
	To enable process accounting, setting accounting=YES
	in /etc/rc.conf is insufficient, someone also has to go
	create /var/account/acct as well.

>How-To-Repeat:
	Take one virgin system (anything since /etc/rc.d will do, though
	the same problem existed before then), set accounting=YES in rc.conf
	and fail to see accounting started (there's not even a warning
	message).
>Fix:
	Fixing this is trivial.   Apply the following patch to
	/etc/rc.d/accounting (src/etc/rc.d/accounting)
	There's no rational reason why a human has to go create the
	accounting file, if the local admin has said they want
	accounting with "accounting=YES" then accounting should be done.

	Apart from this, the comment in /etc/defaults/rc.conf about
	"also need /etc/account/acct" should be deleted.

--- /tmp/accounting	Tue Apr 24 19:58:07 2001
+++ accounting	Tue Apr 24 19:58:55 2001
@@ -14,12 +14,11 @@
 stop_cmd="accounting_stop"
 
 accounting_start()
 {
-	if [ -f /var/account/acct ]; then
-		echo "Turning on accounting."
-		/usr/sbin/accton /var/account/acct
-	fi
+	echo "Turning on accounting."
+	>> /var/account/acct
+	/usr/sbin/accton /var/account/acct
 }
 
 accounting_stop()
 {
>Release-Note:
>Audit-Trail:
>Unformatted: