HomeFreeBSD

310.accounting: Verify process accounting is active before log rotation.

Description

310.accounting: Verify process accounting is active before log rotation.

This corrects a bug in which the daily periodic script '310.accounting'
attempts to rotate logs via /etc/rc.d/accounting by calling
onerotate_logs function. The rotate logs function turns accounting back
on regardless of what acccounting_enable is set to in /etc/rc.conf. This
is due to checkyesno always returning YES since rotate logs is called
with the 'one' prefix.

In effect, accounting will always be turned back on once a day even if
it is disabled and stopped by hand. The fix was simple, just check if
accounting is before rotating logs and if it is, don't attempt the
rotate.

PR: 267464
Reviewed by: imp, hps (lgtm, not approval), Mina Galić
Pull Request: https://github.com/freebsd/freebsd-src/pull/648
Differential Revision: https://reviews.freebsd.org/D37434

Details

Provenance
john.grafton_runbox.comAuthored on Feb 28 2023, 4:49 PM
impCommitted on Feb 28 2023, 4:59 PM
Reviewer
imp
Differential Revision
D37434: check if accounting is active before attempting to rotate accounting logs
Parents
rG5f7bea295283: iflib: fix regression with new pfil(9) KPI
Branches
Unknown
Tags
Unknown