summaryrefslogtreecommitdiffstats
path: root/etc/periodic
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-05-30 16:46:53 +0000
committerbrian <brian@FreeBSD.org>2001-05-30 16:46:53 +0000
commit4358d0941ffb42b2c5e5bb7583e73e86acb617f9 (patch)
treefb1e2f97dff23d446764b781693fc2cbefc3b204 /etc/periodic
parentc8969dd00c5ee1c25c896be1e3904c0b31f7106c (diff)
downloadFreeBSD-src-4358d0941ffb42b2c5e5bb7583e73e86acb617f9.zip
FreeBSD-src-4358d0941ffb42b2c5e5bb7583e73e86acb617f9.tar.gz
Add $daily_accounting_save and $daily_accounting_flags
Submitted by: Udo Schweigert <Udo.Schweigert@cert.siemens.de> MFC after: 2 weeks
Diffstat (limited to 'etc/periodic')
-rwxr-xr-xetc/periodic/daily/310.accounting22
1 files changed, 13 insertions, 9 deletions
diff --git a/etc/periodic/daily/310.accounting b/etc/periodic/daily/310.accounting
index c510a94..2f9792a 100755
--- a/etc/periodic/daily/310.accounting
+++ b/etc/periodic/daily/310.accounting
@@ -24,16 +24,20 @@ case "$daily_accounting_enable" in
cd /var/account
rc=0
-
- rm -f acct.3.gz acct.3 || rc=3
- [ -f acct.2.gz ] && { mv -f acct.2.gz acct.3.gz || rc=3; }
- [ -f acct.2 ] && { mv -f acct.2 acct.3 || rc=3; }
- [ -f acct.1.gz ] && { mv -f acct.1.gz acct.2.gz || rc=3; }
- [ -f acct.1 ] && { mv -f acct.1 acct.2 || rc=3; }
- [ -f acct.0.gz ] && { mv -f acct.0.gz acct.1.gz || rc=3; }
- [ -f acct.0 ] && { mv -f acct.0 acct.1 || rc=3; }
+
+ n=$daily_accounting_save
+ rm -f acct.$n.gz acct.$n || rc=3
+ m=$n
+ n=$(($n - 1))
+ while [ $n -ge 0 ]
+ do
+ [ -f acct.$n.gz ] && { mv -f acct.$n.gz acct.$m.gz || rc=3; }
+ [ -f acct.$n ] && { mv -f acct.$n acct.$m || rc=3; }
+ m=$n
+ n=$(($n - 1))
+ done
cp -pf acct acct.0 || rc=3
- sa -s >/dev/null || rc=3
+ sa -s $daily_accounting_flags || rc=3
case "$daily_accounting_compress" in
[Yy][Ee][Ss])
OpenPOWER on IntegriCloud