aboutsummaryrefslogtreecommitdiff
path: root/etc/periodic/monthly
diff options
context:
space:
mode:
authorDaniel O'Callaghan <danny@FreeBSD.org>1998-02-09 11:36:43 +0000
committerDaniel O'Callaghan <danny@FreeBSD.org>1998-02-09 11:36:43 +0000
commit8e525b080383949bc72a5217f0cdbb20104b0078 (patch)
tree9efd507a7366131b6ddaf80d769e2bb4e5c3ecc3 /etc/periodic/monthly
parentb2ba5803909c32e2a019c53d8695f0f70fffd6d5 (diff)
downloadsrc-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')
-rwxr-xr-xetc/periodic/monthly/200.accounting22
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