Date: Thu, 5 Feb 1998 02:50:01 -0800 (PST) From: "Daniel O'Callaghan" <danny@panda.hilink.com.au> To: freebsd-bugs Subject: Re: bin/5448 /etc/monthly reports are incorrect Message-ID: <199802051050.CAA29471@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/5448; it has been noted by GNATS.
From: "Daniel O'Callaghan" <danny@panda.hilink.com.au>
To: freebsd-gnats-submit@freebsd.org, freebsd-hackers@freebsd.org
Cc: Subject: Re: bin/5448 /etc/monthly reports are incorrect
Date: Thu, 5 Feb 1998 21:44:40 +1100 (EST)
I'd like to propose the files below as new /etc/monthly and
/etc/periodic/monthly/200.accounting, pending development of a logrotate
command. I don't think I'll get logrotate done in time for 2.2.6, but I
think that the current system of rotating wtmp in /etc/newsyslog.conf,
and generating "monthly" reports of account activity leaves a lot to be
desired. This will allow PRs 1708, 1941 and 5448 to be closed.
Please review.
Thanks,
Danny
-----------------------
#!/bin/sh -
#
# $Id: 200.accounting,v 1.1.1.1 1997/08/16 17:04:01 pst Exp $
#
if [ -x /usr/sbin/ac ] ; then
echo ""
echo "Doing login accounting:"
W=/var/log/wtmp
# Work out what month it was yesterday
s1=`date +%s`
s2=`expr $s1 - 86400`
M=`date -r $s2 +%h`
mv $W $W.$M
touch $W
ac -p -w $W.$M | sort -nr +1
rm -f $W.$M.gz
gzip $W.$M
fi
--------------------------------------------------------
#!/bin/sh -
#
# /etc/monthly
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
host=`hostname -s`
echo "Subject: $host monthly run output"
echo ""
echo "Doing login accounting:"
W=/var/log/wtmp
# Work out what month it was yesterday
s1=`date +%s`
s2=`expr $s1 - 86400`
M=`date -r $s2 +%h`
mv $W $W.$M
touch $W
ac -p -w $W.$M | sort -nr +1
rm -f $W.$M.gz
gzip $W.$M
if [ -f /etc/monthly.local ]; then
echo ""
echo "Running monthly.local:"
sh /etc/monthly.local
fi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802051050.CAA29471>
