From owner-freebsd-hackers Thu Feb 5 02:44:52 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA28549 for hackers-outgoing; Thu, 5 Feb 1998 02:44:52 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from panda.hilink.com.au (panda.hilink.com.au [203.8.15.25]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA28530; Thu, 5 Feb 1998 02:44:45 -0800 (PST) (envelope-from danny@panda.hilink.com.au) Received: (from danny@localhost) by panda.hilink.com.au (8.8.5/8.8.5) id VAA10351; Thu, 5 Feb 1998 21:44:40 +1100 (EST) Date: Thu, 5 Feb 1998 21:44:40 +1100 (EST) From: "Daniel O'Callaghan" To: freebsd-gnats-submit@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: bin/5448 /etc/monthly reports are incorrect Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe hackers" 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