From owner-freebsd-bugs Thu Feb 5 02:50:03 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA29477 for freebsd-bugs-outgoing; Thu, 5 Feb 1998 02:50:03 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: (from gnats@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA29471; Thu, 5 Feb 1998 02:50:01 -0800 (PST) (envelope-from gnats) Date: Thu, 5 Feb 1998 02:50:01 -0800 (PST) Message-Id: <199802051050.CAA29471@hub.freebsd.org> To: freebsd-bugs Cc: From: "Daniel O'Callaghan" Subject: Re: bin/5448 /etc/monthly reports are incorrect Reply-To: "Daniel O'Callaghan" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe freebsd-bugs" The following reply was made to PR bin/5448; it has been noted by GNATS. From: "Daniel O'Callaghan" 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