Page MenuHomeFreeBSD

check if accounting is active before attempting to rotate accounting logs
Needs ReviewPublic

Authored by john.grafton_runbox.com on Fri, Nov 18, 4:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 2, 12:38 PM
Unknown Object (File)
Fri, Dec 2, 12:38 PM
Unknown Object (File)
Mon, Nov 28, 1:31 PM

Details

Reviewers
None
Group Reviewers
Src Committers
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