Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/periodic/etc/monthly/200.accounting
Context not available. | |||||
W=/var/log/utx.log | W=/var/log/utx.log | ||||
rc=0 | rc=0 | ||||
remove=NO | remove=NO | ||||
filetoread=$W.0 | |||||
if [ ! -f $W.0 ] | if [ ! -f $W.0 ] | ||||
then | then | ||||
if [ -f $W.0.gz ] | if [ -f $W.0.gz ] || [ -f $W.0.bz2 ] || [ -f $W.0.xz ] || [ -f $W.0.zst ] | ||||
then | then | ||||
TMP=`mktemp -t accounting` | |||||
remove=YES | remove=YES | ||||
zcat $W.0.gz > $W.0 || rc=1 | filetoread=$TMP | ||||
elif [ -f $W.0.bz2 ] | if [ -f $W.0.gz ] | ||||
then | then | ||||
remove=YES | zcat $W.0.gz > $TMP || rc=1 | ||||
bzcat $W.0.bz2 > $W.0 || rc=1 | elif [ -f $W.0.bz2 ] | ||||
then | |||||
bzcat $W.0.bz2 > $TMP || rc=1 | |||||
elif [ -f $W.0.xz ] | |||||
then | |||||
xzcat $W.0.xz > $TMP || rc=1 | |||||
elif [ -f $W.0.zst ] | |||||
then | |||||
zstdcat $W.0.zst > $TMP || rc=1 | |||||
else | |||||
# shouldn't get here, unless something disappeared under us. | |||||
rc=2 | |||||
fi | |||||
else | else | ||||
echo '$monthly_accounting_enable is set but' \ | echo '$monthly_accounting_enable is set but' \ | ||||
"$W.0 doesn't exist" | "$W.0 doesn't exist" | ||||
Context not available. | |||||
echo "" | echo "" | ||||
echo "Doing login accounting:" | echo "Doing login accounting:" | ||||
rc=$(ac -p -w $W.0 | sort -nr -k 2 | tee /dev/stderr | wc -l) | rc=$(ac -p -w $filetoread | sort -nr -k 2 | tee /dev/stderr | wc -l) | ||||
[ $rc -gt 0 ] && rc=1 | [ $rc -gt 0 ] && rc=1 | ||||
fi | fi | ||||
[ $remove = YES ] && rm -f $W.0;; | [ $remove = YES ] && rm -f $TMP;; | ||||
*) rc=0;; | *) rc=0;; | ||||
esac | esac | ||||
Context not available. |