diff options
author | Daniel O'Callaghan <danny@FreeBSD.org> | 1998-02-09 11:36:43 +0000 |
---|---|---|
committer | Daniel O'Callaghan <danny@FreeBSD.org> | 1998-02-09 11:36:43 +0000 |
commit | 8e525b080383949bc72a5217f0cdbb20104b0078 (patch) | |
tree | 9efd507a7366131b6ddaf80d769e2bb4e5c3ecc3 /etc/periodic/monthly/200.accounting | |
parent | b2ba5803909c32e2a019c53d8695f0f70fffd6d5 (diff) | |
download | src-8e525b080383949bc72a5217f0cdbb20104b0078.tar.gz src-8e525b080383949bc72a5217f0cdbb20104b0078.zip |
PR: 1708, 5448
Reviewed by: Alex Nash, Steve Price
Enhance wtmp monthly handling
Notes
Notes:
svn path=/head/; revision=33186
Diffstat (limited to 'etc/periodic/monthly/200.accounting')
-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 14ca582e43c6..6361f1da8e03 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 |