From jonny@coppe.ufrj.br Tue Jan 6 16:47:34 1998 Received: from gaia.coppe.ufrj.br (cisigw.coppe.ufrj.br [146.164.5.200]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id QAA13423 for ; Tue, 6 Jan 1998 16:47:32 -0800 (PST) (envelope-from jonny@coppe.ufrj.br) Received: (from jonny@localhost) by gaia.coppe.ufrj.br (8.8.8/8.8.8) id WAA07422; Tue, 6 Jan 1998 22:47:30 -0200 (EDT) (envelope-from jonny) Message-Id: <199801070047.WAA07422@gaia.coppe.ufrj.br> Date: Tue, 6 Jan 1998 22:47:30 -0200 (EDT) From: Joao Carlos Mendes Luis Reply-To: jonny@coppe.ufrj.br To: FreeBSD-gnats-submit@freebsd.org Subject: /etc/monthly reports are incorrect X-Send-Pr-Version: 3.2 >Number: 5448 >Category: bin >Synopsis: /etc/monthly reports are incorrect >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jan 8 14:32:21 PST 1998 >Closed-Date: Mon Feb 9 03:49:14 PST 1998 >Last-Modified: Mon Feb 9 03:50:15 PST 1998 >Originator: Joao Carlos Mendes Luis >Release: FreeBSD 2.2.5-STABLE i386 >Organization: COPPE/UFRJ >Environment: FreeBSD -stable, but think -current also suffers this Default configuration from installation >Description: /etc/monthly generates reports with ac(8), which reads /var/log/wtmp It's expected to give some monthly accounting. But /var/log/wtmp is rotated from crontab, and does not respects /etc/monthly, making the reports without any accuracy. >How-To-Repeat: Wait until cron rotates /var/log/wtmp just a few hours before running /etc/monthly, and see the extremely small times reported. It happened to me this month. :) >Fix: Execute /var/log/wtmp rotation at /etc/monthly. >Release-Note: >Audit-Trail: 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 From: Joao Carlos Mendes Luis To: danny@panda.hilink.com.au (Daniel O'Callaghan) Cc: freebsd-gnats-submit@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: bin/5448 /etc/monthly reports are incorrect Date: Sun, 8 Feb 1998 22:15:39 -0200 (EDT) #define quoting(Daniel O'Callaghan) // 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. It's ok for 1708 and 5448, but I can't see how this solves 1941. The pending for a real logrotate will make easier to have this kind of report weekly instead of monthly. Just change the script directory. Jonny -- Joao Carlos Mendes Luis jonny@gta.ufrj.br +55 21 290-4698 jonny@coppe.ufrj.br Universidade Federal do Rio de Janeiro UFRJ/COPPE/CISI PGP fingerprint: 29 C0 50 B9 B6 3E 58 F2 83 5F E3 26 BF 0F EA 67 State-Changed-From-To: open->closed State-Changed-By: danny State-Changed-When: Mon Feb 9 03:49:14 PST 1998 State-Changed-Why: A solution was found and applied. >Unformatted: