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)
Wed, Oct 1, 10:05 AM
Unknown Object (File)
Fri, Sep 19, 10:47 PM
Unknown Object (File)
Wed, Sep 17, 11:37 AM
Unknown Object (File)
Wed, Sep 17, 8:23 AM
Unknown Object (File)
Wed, Sep 17, 5:31 AM
Unknown Object (File)
Tue, Sep 16, 11:25 PM
Unknown Object (File)
Sep 13 2025, 10:17 PM
Unknown Object (File)
Aug 30 2025, 11:25 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 Not Applicable
Unit
Tests Not Applicable