Subject: misc/18628: /etc/daily doesn't deal with gzip'd accounting archives
To: None <email@example.com>
From: None <kre@munnari.OZ.AU>
Date: 10/12/2002 16:58:32
>Synopsis: /etc/daily doesn't deal with gzip'd accounting archives
>Arrival-Date: Sat Oct 12 03:00:00 PDT 2002
>Originator: Robert Elz
>Release: NetBSD -current
Prince of Songkla University
System: NetBSD delta.cs.mu.OZ.AU 1.5ZC NetBSD 1.5ZC (DELTA) #4: Mon May 27 23:17:55 ICT 2002 firstname.lastname@example.org.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.
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
/etc/rc.d/accounting forcestart ;# if not enabled already
sleep 345600 ; # 4 days
ls -l /var/account
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 "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
+ 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
cp /var/account/acct /var/account/acct.0
+ if [ -f /var/account/acct.1.gz ]; then
+ gzip /var/account/acct.0
if checkyesno run_calendar; then