Add $daily_accounting_save and $daily_accounting_flags

Submitted by:	Udo Schweigert <Udo.Schweigert@cert.siemens.de>
MFC after:	2 weeks
This commit is contained in:
Brian Somers 2001-05-30 16:46:53 +00:00
parent af8dcd940f
commit c4d5bb5129
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77492
3 changed files with 33 additions and 9 deletions

View File

@ -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

View File

@ -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])

View File

@ -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