Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Nov 2022 01:39:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 267464] periodic 310.accounting enables accounting even if it is disabled in rc.conf
Message-ID:  <bug-267464-227-WDWVl7xBP4@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-267464-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-267464-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267464

--- Comment #3 from John Grafton <john.grafton@runbox.com> ---
Ignore the last patch, it's too hacky.  Grepping for the system process is
problematic due to the possibility of a process other than accounting retur=
ning
true for the grep.

This patch uses the kern.acct_configured sysctl to determine if accounting =
is
active instead.

diff --git a/usr.sbin/periodic/etc/daily/310.accounting
b/usr.sbin/periodic/etc/daily/310.accounting
index b0dd786447eb..8eeed16f0516 100755
--- a/usr.sbin/periodic/etc/daily/310.accounting
+++ b/usr.sbin/periodic/etc/daily/310.accounting
@@ -18,6 +18,11 @@ case "$daily_accounting_enable" in
            echo '$daily_accounting_enable is set but /var/account/acct' \
                "doesn't exist"
            rc=3D2
+       elif [ $(sysctl -n kern.acct_configured) -eq 0 ]
+       then
+           echo '$daily_accounting_enable is set but' \
+           'process accounting is not active'
+           rc=3D2
        elif [ -z "$daily_accounting_save" ]
        then
            echo '$daily_accounting_enable is set but ' \

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-267464-227-WDWVl7xBP4>