diff options
| author | Brian Somers <brian@FreeBSD.org> | 2001-05-30 16:46:53 +0000 |
|---|---|---|
| committer | Brian Somers <brian@FreeBSD.org> | 2001-05-30 16:46:53 +0000 |
| commit | c4d5bb512909b831892524e4f6780a002d503135 (patch) | |
| tree | 569d6b9b5196861eaaf81c2307514dd61cea1632 | |
| parent | af8dcd940f5d738e717f05a15be926e920945d32 (diff) | |
Notes
| -rw-r--r-- | etc/defaults/periodic.conf | 2 | ||||
| -rwxr-xr-x | etc/periodic/daily/310.accounting | 22 | ||||
| -rw-r--r-- | share/man/man5/periodic.conf.5 | 18 |
3 files changed, 33 insertions, 9 deletions
diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf index 8b838995552e..2f2d2a465952 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 c510a94209a2..2f9792a1b1b4 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 a5a5c2fc465a..bf1fa1cef825 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 |
