diff options
author | brian <brian@FreeBSD.org> | 2001-05-30 16:46:53 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2001-05-30 16:46:53 +0000 |
commit | 4358d0941ffb42b2c5e5bb7583e73e86acb617f9 (patch) | |
tree | fb1e2f97dff23d446764b781693fc2cbefc3b204 /etc | |
parent | c8969dd00c5ee1c25c896be1e3904c0b31f7106c (diff) | |
download | FreeBSD-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')
-rw-r--r-- | etc/defaults/periodic.conf | 2 | ||||
-rwxr-xr-x | etc/periodic/daily/310.accounting | 22 |
2 files changed, 15 insertions, 9 deletions
diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf index 8b83899..2f2d2a4 100644 --- a/etc/defaults/periodic.conf +++ b/etc/defaults/periodic.conf @@ -79,6 +79,8 @@ daily_calendar_enable="NO" # Run calendar -a # 310.accounting daily_accounting_enable="YES" # Rotate acct files daily_accounting_compress="NO" # Gzip rotated files +daily_accounting_flags= # Flags to /usr/sbin/sa +daily_accounting_save=3 # How many files to save # 320.distfile daily_distfile_enable="YES" # Run rdist daily 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]) |