|
Lines 19-28
Link Here
|
| 19 |
echo "Rotating accounting logs and gathering statistics:" |
19 |
echo "Rotating accounting logs and gathering statistics:" |
| 20 |
|
20 |
|
| 21 |
cd /var/account |
21 |
cd /var/account |
| 22 |
[ -f acct.2 ] && mv -f acct.2 acct.3 |
22 |
|
| 23 |
[ -f acct.1 ] && mv -f acct.1 acct.2 |
23 |
# Delete any old files left around if the user changes from |
| 24 |
[ -f acct.0 ] && mv -f acct.0 acct.1 |
24 |
# non-compressed to compressed or vice-versa. |
|
|
25 |
find . -name 'acct.*' -mtime +5 -delete |
| 26 |
|
| 27 |
# Does the user want the files compressed? |
| 28 |
case "$daily_accounting_compress" in |
| 29 |
[Yy][Ee][Ss]) |
| 30 |
ext=".gz" ;; |
| 31 |
*) |
| 32 |
ext="" ;; |
| 33 |
esac |
| 34 |
|
| 35 |
[ -f acct.2$ext ] && mv -f acct.2$ext acct.3$ext |
| 36 |
[ -f acct.1$ext ] && mv -f acct.1$ext acct.2$ext |
| 37 |
[ -f acct.0$ext ] && mv -f acct.0$ext acct.1$ext |
| 25 |
cp -pf acct acct.0 |
38 |
cp -pf acct acct.0 |
| 26 |
sa -s >/dev/null |
39 |
sa -s >/dev/null |
|
|
40 |
|
| 41 |
case "$daily_accounting_compress" in |
| 42 |
[Yy][Ee][Ss]) |
| 43 |
gzip -f acct.0 ;; |
| 44 |
esac |
| 27 |
fi;; |
45 |
fi;; |
| 28 |
esac |
46 |
esac |