sys-process/acct currently doesn't offer a logrotate script which can enable the /var/account/pacct file to grow quite large. i've attached a logrotate script that i took from red hat and modified it for gentoo Reproducible: Always Steps to Reproduce: 1. /etc/init.d/acct start 2. /var/account/pacct file continues to grow 3. /usr/sbin/logrotate /etc/logrotate.conf doesnt manage the pacct file Expected Results: the sys-process/acct ebuild should contain a useful logrotate script
Created attachment 226561 [details] logrotate script for sys-process/acct
i also modified the /etc/init.d/acct script and added 'off' to the 'accton' line in the stop stanza: stop() { ebegin "Stopping accounting" accton off eend $? }
another note....the ebuild should contain the /var/account/pacct file as a null file with the proper ownership/permissions otherwise logrotate will complain about the file not being present
(In reply to comment #2) > i also modified the /etc/init.d/acct script and added 'off' to the 'accton' > line in the stop stanza: > > stop() { > ebegin "Stopping accounting" > accton off > eend $? > } > That's already fixed through bug #316517.
I've added your suggested script in sys-process/acct-6.5.4-r1. Thanks for reporting and for the script!
If acct daemon is not started logrotate always fails with error: /var/account/pacct: No such file or directory. Therefore /etc/logrotate.d/acct should include 'missingok' directive. Without missingok: albatros2 ~ # logrotate -v /etc/logrotate.d/acct reading config file /etc/logrotate.d/acct reading config info for /var/account/pacct Handling 1 logs rotating pattern: /var/account/pacct after 1 days (31 rotations) empty log files are not rotated, old logs are removed considering log /var/account/pacct error: stat of /var/account/pacct failed: Нет такого файла или каталога With missingok: albatros2 ~ # logrotate -v /etc/logrotate.d/acct reading config file /etc/logrotate.d/acct reading config info for /var/account/pacct Handling 1 logs rotating pattern: /var/account/pacct after 1 days (31 rotations) empty log files are not rotated, old logs are removed considering log /var/account/pacct log /var/account/pacct does not exist -- skipping not running prerotate script, since no logs will be rotated not running postrotate script, since no logs were rotated
(In reply to comment #6) > If acct daemon is not started logrotate always fails with error: RCS file: /var/cvsroot/gentoo-x86/sys-process/acct/files/acct.logrotate,v Working file: files/acct.logrotate head: 1.2 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: ---------------------------- revision 1.2 date: 2010-11-11 08:52:10 +0100; author: jer; state: Exp; lines: +1 -0; commitid: 1 2924cdba0aa4567; Add missingok by Tom Hendrikx (bug #344963). (Portage version: 2.1.9.24/cvs/Linux i686) Please don't hijack seemingly related bug reports.