Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 1998 21:44:40 +1100 (EST)
From:      "Daniel O'Callaghan" <danny@panda.hilink.com.au>
To:        freebsd-gnats-submit@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG
Subject:   Re: bin/5448 /etc/monthly reports are incorrect
Message-ID:  <Pine.BSF.3.91.980205213750.294c-100000@panda.hilink.com.au>

next in thread | raw e-mail | index | archive | help

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?Pine.BSF.3.91.980205213750.294c-100000>