Subject: misc/18628: /etc/daily doesn't deal with gzip'd accounting archives
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 10/12/2002 16:58:32
>Number: 18628
>Category: misc
>Synopsis: /etc/daily doesn't deal with gzip'd accounting archives
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: misc-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Oct 12 03:00:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Robert Elz
>Release: NetBSD -current
>Organization:
Prince of Songkla University
>Environment:
System: NetBSD delta.cs.mu.OZ.AU 1.5ZC NetBSD 1.5ZC (DELTA) #4: Mon May 27 23:17:55 ICT 2002 kre@delta.cs.mu.OZ.AU:/usr/src/sys.X/arch/i386/compile/DELTA i386
That's from the system on which send-pr was run, and isn't relevant.
Architecture: i386
Machine: i386
>Description:
If process accounting is enabled, large accounting files
accumulate in /var/account. /etc/daily deals with that
by saving the last 4 days worth, (and summarising the data
into the summary files using sa).
The accountig files can be very large - especially on a system
which isn't necessarily running every day when /etc/daily would
be run, and so can accumulate many days worth of process info.
The also gzip very well.
Doing "gzip /var/account/acct.?" is an easy way to recover lots
of space on /var, without losing any information. But once done,
those gzip'd files are retained until some human action intervenes.
Files that aren't gzip'd accumulate again. Thus, after a few
days, gzip'ing the files results in gret
>How-To-Repeat:
/etc/rc.d/accounting forcestart ;# if not enabled already
gzip /var/account/acct.?
sleep 345600 ; # 4 days
ls -l /var/account
>Fix:
The patch appended has /etc/daily notice if the accunting archive
files have been gzip'd, and if so, processes them gzip'd. It doesn't
add functionality to decide the files should be gzip'd, that remains
for the user to do manually.
--- daily Mon Jan 28 05:08:50 2002
+++ /etc/daily Sat Oct 12 11:45:50 2002
@@ -115,11 +115,20 @@
if checkyesno purge_accounting && [ -f /var/account/acct ]; then
echo ""
echo "Purging accounting records:"
- mv /var/account/acct.2 /var/account/acct.3 2>/dev/null
- mv /var/account/acct.1 /var/account/acct.2 2>/dev/null
- mv /var/account/acct.0 /var/account/acct.1 2>/dev/null
+ if [ -f /var/account/acct.0.gz ]; then
+ mv /var/account/acct.2.gz /var/account/acct.3.gz 2>/dev/null
+ mv /var/account/acct.1.gz /var/account/acct.2.gz 2>/dev/null
+ mv /var/account/acct.0.gz /var/account/acct.1.gz 2>/dev/null
+ else
+ mv /var/account/acct.2 /var/account/acct.3 2>/dev/null
+ mv /var/account/acct.1 /var/account/acct.2 2>/dev/null
+ mv /var/account/acct.0 /var/account/acct.1 2>/dev/null
+ fi
cp /var/account/acct /var/account/acct.0
sa -sq
+ if [ -f /var/account/acct.1.gz ]; then
+ gzip /var/account/acct.0
+ fi
fi
if checkyesno run_calendar; then
>Release-Note:
>Audit-Trail:
>Unformatted: