Page MenuHomeFreeBSD

check if accounting is active before attempting to rotate accounting logs
ClosedPublic

Authored by john.grafton_runbox.com on Nov 18 2022, 4:12 PM.
Tags
None
Referenced Files
F175999488: D37434.diff
Thu, Oct 15, 4:34 AM
Unknown Object (File)
Mon, Oct 12, 1:27 AM
Unknown Object (File)
Wed, Oct 7, 7:53 PM
Unknown Object (File)
Sun, Sep 27, 10:45 AM
Unknown Object (File)
Fri, Sep 25, 9:33 PM
Unknown Object (File)
Thu, Sep 24, 11:26 AM
Unknown Object (File)
Sep 13 2026, 12:07 PM
Unknown Object (File)
Sep 12 2026, 10:14 PM

Details

Summary

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.

Test Plan
  1. service accounting onestart
  2. ps auxww | grep accounting
  1. service accounting onestop
  2. ps auxww | grep accounting
  3. periodic daily
  4. ps auxww | grep accounting

accounting will automagically be turned back on

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 48419
Build 45305: arc lint + arc unit