1997-08-16 17:04:02 +00:00
|
|
|
#!/bin/sh -
|
|
|
|
#
|
1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
1997-08-16 17:04:02 +00:00
|
|
|
#
|
|
|
|
|
2000-06-23 01:18:31 +00:00
|
|
|
# If there is a global system configuration file, suck it in.
|
|
|
|
#
|
|
|
|
if [ -r /etc/defaults/periodic.conf ]
|
|
|
|
then
|
|
|
|
. /etc/defaults/periodic.conf
|
|
|
|
source_periodic_confs
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$monthly_accounting_enable" in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
W=/var/log/wtmp
|
2001-11-20 15:01:24 +00:00
|
|
|
rc=0
|
|
|
|
remove=NO
|
2000-09-14 17:19:15 +00:00
|
|
|
if [ ! -f $W.0 ]
|
2000-06-23 01:18:31 +00:00
|
|
|
then
|
2001-11-20 15:01:24 +00:00
|
|
|
if [ -f $W.0.gz ]
|
|
|
|
then
|
|
|
|
remove=YES
|
|
|
|
zcat $W.0.gz > $W.0 || rc=1
|
|
|
|
else
|
|
|
|
echo '$monthly_accounting_enable is set but' \
|
|
|
|
"$W.0 doesn't exist"
|
|
|
|
rc=2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ $rc -eq 0 ]
|
|
|
|
then
|
2000-09-14 17:19:15 +00:00
|
|
|
echo ""
|
|
|
|
echo "Doing login accounting:"
|
1998-02-09 11:36:43 +00:00
|
|
|
|
2000-09-14 17:19:15 +00:00
|
|
|
rc=$(ac -p -w $W.0 | sort -nr +1 | tee /dev/stderr | wc -l)
|
|
|
|
[ $rc -gt 0 ] && rc=1
|
2001-11-20 15:01:24 +00:00
|
|
|
fi
|
|
|
|
[ $remove = YES ] && rm -f $W.0;;
|
2000-09-14 17:19:15 +00:00
|
|
|
|
|
|
|
*) rc=0;;
|
2000-06-23 01:18:31 +00:00
|
|
|
esac
|
2000-09-14 17:19:15 +00:00
|
|
|
|
|
|
|
exit $rc
|