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
Unknown Object (File)
Mar 16 2024, 4:22 AM
Unknown Object (File)
Mar 16 2024, 4:22 AM
Unknown Object (File)
Mar 12 2024, 10:08 AM
Unknown Object (File)
Mar 8 2024, 5:25 AM
Unknown Object (File)
Dec 12 2023, 1:43 AM
Unknown Object (File)
Dec 1 2023, 10:43 PM
Unknown Object (File)
Sep 6 2023, 4:14 AM
Unknown Object (File)
Jul 24 2023, 6:31 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