summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--etc/defaults/periodic.conf2
-rwxr-xr-xetc/periodic/daily/310.accounting22
-rw-r--r--share/man/man5/periodic.conf.518
3 files changed, 33 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])
diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5
index a5a5c2f..bf1fa1c 100644
--- a/share/man/man5/periodic.conf.5
+++ b/share/man/man5/periodic.conf.5
@@ -298,6 +298,24 @@ Set to
.Dq YES
if you want your daily accounting files to be compressed using
.Xr gzip 1 .
+.It Ar daily_accounting_save
+.Pq num
+When
+.Ar daily_accounting_enable
+is set, this may also be set to the number of daily accounting files that are
+to be saved.
+The default is
+.Dq 3 .
+.It Ar daily_accounting_flags
+.Pq Vt str
+Set to the arguments to pass to the
+.Xr sa 1
+utility (in addition to
+.Fl s )
+when
+.Ar daily_accounting_enable
+is set to
+.Dq YES .
.It Va daily_distfile_enable
.Pq Vt bool
Set to
OpenPOWER on IntegriCloud