Subject: Compress accounting?
To: NetBSD Current Users <>
From: Greywolf <>
List: current-users
Date: 08/05/2003 11:53:26
Felix ex lupus in andros e gynos,

I've hit a point where I should probably remake /var, but having found an
alternate solution, I thought I should suggest it.

I have a patch to /etc/daily which will enable the proper
compression/moving of accounting files resulting in a SIGNIFICANT space
savings.  I was driven to this by the fact that a " [args] build"
generates a HUGE amount of accounting information, and /var no longer
has the space to allow the editing of the copious amounts of output
saved by (my incantation of) a build into a file.

Patch enclosed; pardon me if it's not in The Approved Style of shell
scripting [rationale for my style is available for anyone who really
gives a whistle about it].

Should I send-pr?

#### patch (unidiff) to /etc/daily
--- /usr/src/etc/daily	2003-02-22 03:01:11.000000000 -0800
+++	2003-08-05 11:52:04.000000000 -0700
@@ -115,11 +115,18 @@
 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
+	for i in 2 1 0; do {
+	    nexti=`expr $i + 1`;
+	    curfn=/var/account/acct.$i*;
+	    nextfn=`echo $curfn | sed "s/$i/$nexti/"`;
+	    mv $curfn $nextfn 2>/dev/null;
+	} done;
 	cp /var/account/acct /var/account/acct.0
 	sa -sq
+	if checkyesno compress_accounting; then {
+	    echo "Compressing accounting:"
+	    gzip -v9 /var/account/acct.0;
+	} fi;

 if checkyesno run_calendar; then

#### end patch....
NetBSD: Bastion Ultimatum ex Ecclesio UNIX.