summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/defaults/periodic.conf1
-rwxr-xr-xetc/periodic/daily/310.accounting10
2 files changed, 11 insertions, 0 deletions
diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf
index 68a18cf..ee72787 100644
--- a/etc/defaults/periodic.conf
+++ b/etc/defaults/periodic.conf
@@ -68,6 +68,7 @@ daily_calendar_enable="NO" # Run calendar -a
# 310.accounting
daily_accounting_enable="YES" # Rotate acct files
+daily_accounting_compress="NO" # Gzip rotated files
# 320.distfile
daily_distfile_enable="YES" # Run rdist daily
diff --git a/etc/periodic/daily/310.accounting b/etc/periodic/daily/310.accounting
index 15e5c6d..2baf232 100755
--- a/etc/periodic/daily/310.accounting
+++ b/etc/periodic/daily/310.accounting
@@ -19,10 +19,20 @@ case "$daily_accounting_enable" in
echo "Rotating accounting logs and gathering statistics:"
cd /var/account
+
+ rm -f acct.3.gz acct.3
+ [ -f acct.2.gz ] && mv -f acct.2.gz acct.3.gz
[ -f acct.2 ] && mv -f acct.2 acct.3
+ [ -f acct.1.gz ] && mv -f acct.1.gz acct.2.gz
[ -f acct.1 ] && mv -f acct.1 acct.2
+ [ -f acct.0.gz ] && mv -f acct.0.gz acct.1.gz
[ -f acct.0 ] && mv -f acct.0 acct.1
cp -pf acct acct.0
sa -s >/dev/null
+
+ case "$daily_accounting_compress" in
+ [Yy][Ee][Ss])
+ gzip -f acct.0;;
+ esac
fi;;
esac
OpenPOWER on IntegriCloud