128263Spst#!/bin/sh - 228263Spst# 350472Speter# $FreeBSD$ 428263Spst# 528263Spst 661981Sbrian# If there is a global system configuration file, suck it in. 761981Sbrian# 861981Sbrianif [ -r /etc/defaults/periodic.conf ] 961981Sbrianthen 1061981Sbrian . /etc/defaults/periodic.conf 1161981Sbrian source_periodic_confs 1261981Sbrianfi 1361981Sbrian 1496813Sbrianoldmask=$(umask) 1596813Sbrianumask 066 1661981Sbriancase "$monthly_accounting_enable" in 1761981Sbrian [Yy][Ee][Ss]) 18202218Sed W=/var/log/utx.log 1986668Sbrian rc=0 2086668Sbrian remove=NO 2165843Sbrian if [ ! -f $W.0 ] 2261981Sbrian then 2386668Sbrian if [ -f $W.0.gz ] 2486668Sbrian then 2586668Sbrian remove=YES 2686668Sbrian zcat $W.0.gz > $W.0 || rc=1 2795808Sbrian elif [ -f $W.0.bz2 ] 2895808Sbrian then 2995808Sbrian remove=YES 3095808Sbrian bzcat $W.0.bz2 > $W.0 || rc=1 3186668Sbrian else 3286668Sbrian echo '$monthly_accounting_enable is set but' \ 3386668Sbrian "$W.0 doesn't exist" 3486668Sbrian rc=2 3586668Sbrian fi 3686668Sbrian fi 3786668Sbrian if [ $rc -eq 0 ] 3886668Sbrian then 3965843Sbrian echo "" 4065843Sbrian echo "Doing login accounting:" 4133186Sdanny 42103903Sache rc=$(ac -p -w $W.0 | sort -nr -k 2 | tee /dev/stderr | wc -l) 4365843Sbrian [ $rc -gt 0 ] && rc=1 4486668Sbrian fi 4586668Sbrian [ $remove = YES ] && rm -f $W.0;; 4665843Sbrian 4765843Sbrian *) rc=0;; 4861981Sbrianesac 4965843Sbrian 5096813Sbrianumask $oldmask 5165843Sbrianexit $rc 52