Skip site navigation (1)Skip section navigation (2)
Date:      Sat,  4 Jan 2003 18:50:47 +0100 (CET)
From:      Stefan Esser <se@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   misc/46759: [Patch] periodic scripts ignore .bz2 files
Message-ID:  <20030104175047.A296C14B3@StefanEsser.FreeBSD.org>

next in thread | raw e-mail | index | archive | help


>Number:         46759
>Category:       misc
>Synopsis:       [Patch] periodic scripts ignore .bz2 files
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 04 10:00:11 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Stefan Esser
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD StefanEsser.FreeBSD.org 5.0-CURRENT FreeBSD 5.0-CURRENT #9: Sat Jan 4 09:52:47 CET 2003 se@StefanEsser.FreeBSD.org:/usr/src/sys/i386/compile/ISDN686 i386


	
>Description:
When newsyslog.conf was modified to compress rotated log files with bzip2
instead of gzip some 3 months ago, most of the periodic scripts that process 
those log files were not tought how to decompress those archived files.

This affects the following scripts:
	etc/periodic/daily/470.status-named
	etc/periodic/security/800.loginfail
	etc/periodic/security/900.tcpwrap
>How-To-Repeat:
Just check the scripts or their output for bzip2ed files ...
>Fix:
Just apply the following patch, which adds bzip2 support without 
dropping gzip support ...

Index: etc/periodic/daily/470.status-named
===================================================================
RCS file: /usr/cvs/src/etc/periodic/daily/470.status-named,v
retrieving revision 1.4
diff -u -r1.4 470.status-named
--- etc/periodic/daily/470.status-named	7 Dec 2002 23:37:44 -0000	1.4
+++ etc/periodic/daily/470.status-named	4 Jan 2003 17:33:00 -0000
@@ -14,7 +14,13 @@
 catmsgs() {
 	find /var/log -name 'messages.*' -mtime -2 |
 	    sort -t. -r -n -k 2,2 |
-	    xargs zcat -f
+	    while read f
+	    do
+		case $f in
+		    *.gz)	zcat -f $f;;
+		    *.bz2)	bzcat -f $f;;
+		esac
+	    done
 	[ -f /var/log/messages ] && cat /var/log/messages
 }
 
Index: etc/periodic/security/800.loginfail
===================================================================
RCS file: /usr/cvs/src/etc/periodic/security/800.loginfail,v
retrieving revision 1.4
diff -u -r1.4 800.loginfail
--- etc/periodic/security/800.loginfail	24 Sep 2002 18:53:46 -0000	1.4
+++ etc/periodic/security/800.loginfail	4 Jan 2003 17:33:15 -0000
@@ -45,7 +45,13 @@
 catmsgs() {
 	find ${LOG} -name 'auth.log.*' -mtime -2 |
 	    sort -t. -r -n -k 2,2 |
-	    xargs zcat -f
+	    while read f
+	    do
+		case $f in
+		    *.gz)	zcat -f $f;;
+		    *.bz2)	bzcat -f $f;;
+		esac
+	    done
 	[ -f ${LOG}/auth.log ] && cat $LOG/auth.log
 }
 
Index: etc/periodic/security/900.tcpwrap
===================================================================
RCS file: /usr/cvs/src/etc/periodic/security/900.tcpwrap,v
retrieving revision 1.2
diff -u -r1.2 900.tcpwrap
--- etc/periodic/security/900.tcpwrap	24 Sep 2002 18:53:46 -0000	1.2
+++ etc/periodic/security/900.tcpwrap	4 Jan 2003 17:33:38 -0000
@@ -45,7 +45,13 @@
 catmsgs() {
 	find ${LOG} -name 'messages.*' -mtime -2 |
 	    sort -t. -r -n -k 2,2 |
-	    xargs zcat -f
+	    while read f
+	    do
+		case $f in
+		    *.gz)	zcat -f $f;;
+		    *.bz2)	bzcat -f $f;;
+		esac
+	    done
 	[ -f ${LOG}/messages ] && cat $LOG/messages
 }
 
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030104175047.A296C14B3>