From 024d4091f50ee8525c9bca061588c3ed1eabc554 Mon Sep 17 00:00:00 2001 From: ajacoutot <> Date: Fri, 2 Feb 2007 14:52:48 +0000 Subject: [PATCH] - enable weekly login accounting if LOGINACCOUNTING is set to 1 in the environment so that it matches the ROOTBACKUP and CHECKFILESYSTEMS way of doing things - make the sort command use "-k" instead of the deprecated "+" option (idea from mk@) - rotate /var/log/wtmp every week just after weekly ac(8) completes ok mk@ --- src/etc/newsyslog.conf | 4 ++-- src/etc/weekly | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/etc/newsyslog.conf b/src/etc/newsyslog.conf index 436d5d4b..29d6ce78 100644 --- a/src/etc/newsyslog.conf +++ b/src/etc/newsyslog.conf @@ -1,4 +1,4 @@ -# $OpenBSD: newsyslog.conf,v 1.25 2005/02/07 06:08:10 david Exp $ +# $OpenBSD: newsyslog.conf,v 1.26 2007/02/02 14:52:48 ajacoutot Exp $ # # configuration file for newsyslog # @@ -11,7 +11,7 @@ /var/log/maillog 600 7 * 24 Z /var/log/messages 644 5 30 * Z /var/log/secure 600 7 * 168 Z -/var/log/wtmp 644 7 * 168 ZB +/var/log/wtmp 644 7 * $W6D4 ZB /var/log/xferlog 640 7 250 * Z /var/log/ppp.log 640 7 250 * Z /var/log/pflog 600 3 250 * ZB /var/run/pflogd.pid diff --git a/src/etc/weekly b/src/etc/weekly index 78530bbc..1a0152a0 100644 --- a/src/etc/weekly +++ b/src/etc/weekly @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: weekly,v 1.18 2006/10/26 12:20:55 ajacoutot Exp $ +# $OpenBSD: weekly,v 1.19 2007/02/02 14:52:48 ajacoutot Exp $ # umask 022 @@ -40,6 +40,10 @@ echo "" echo "Rebuilding whatis databases:" makewhatis -# echo "" -# echo "Doing login accounting:" -# ac -p | sort -nr +1 +# If LOGINACCOUNTING is set to 1 in the environment, report user +# accounting information +[ "X$LOGINACCOUNTING" = X1 ] && { + echo "" + echo "Doing login accounting:" + ac -p | sort -nr -k 2 +}