diff options
author | danny <danny@FreeBSD.org> | 1998-02-09 11:36:43 +0000 |
---|---|---|
committer | danny <danny@FreeBSD.org> | 1998-02-09 11:36:43 +0000 |
commit | 0bab56da41ddd4285ffd81d3ecbee1c59865a3ec (patch) | |
tree | 0b9aef3a412f19a77e8a12ff0d3b72b444a8af79 /etc/periodic | |
parent | d0bf9a43f417ef0656e929d9238c73030427cac4 (diff) | |
download | FreeBSD-src-0bab56da41ddd4285ffd81d3ecbee1c59865a3ec.zip FreeBSD-src-0bab56da41ddd4285ffd81d3ecbee1c59865a3ec.tar.gz |
PR: 1708, 5448
Reviewed by: Alex Nash, Steve Price
Enhance wtmp monthly handling
Diffstat (limited to 'etc/periodic')
-rwxr-xr-x | etc/periodic/monthly/200.accounting | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/etc/periodic/monthly/200.accounting b/etc/periodic/monthly/200.accounting index 14ca582..6361f1d 100755 --- a/etc/periodic/monthly/200.accounting +++ b/etc/periodic/monthly/200.accounting @@ -1,11 +1,23 @@ #!/bin/sh - # -# $Id: 200.accounting,v 1.1.1.1 1997/08/12 17:51:16 pst Exp $ +# $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 +if [ -f $W ] ; then + # Work out last month's name + M=`date -v-1m +%h` - ac -p | sort -nr +1 + mv -f $W $W.$M + touch $W + + if [ -x /usr/sbin/ac ] ; then + echo "" + echo "Doing login accounting:" + + ac -p -w $W.$M | sort -nr +1 + fi + + rm -f $W.$M.gz + gzip $W.$M fi |