[tomcat6] 01/02: add patch for logfile compression; #682955

Tony Mancill tmancill at moszumanska.debian.org
Sun Aug 24 20:20:47 UTC 2014


This is an automated email from the git hooks/post-receive script.

tmancill pushed a commit to branch master
in repository tomcat6.

commit 4bee314f986c12095a1c80a3e5b43af09dff0b4f
Author: tony mancill <tmancill at debian.org>
Date:   Sun Aug 24 13:16:50 2014 -0700

    add patch for logfile compression; #682955
---
 debian/defaults.template  |  2 ++
 debian/tomcat6.cron.daily | 11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/debian/defaults.template b/debian/defaults.template
index 416312c..3ef3280 100644
--- a/debian/defaults.template
+++ b/debian/defaults.template
@@ -33,6 +33,8 @@ JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"
 
 # Number of days to keep logfiles in /var/log/tomcat6. Default is 14 days.
 #LOGFILE_DAYS=14
+# Whether to compress logfiles older than today's
+#LOGFILE_COMPRESS=1
 
 # Location of the JVM temporary directory
 # WARNING: This directory will be destroyed and recreated at every startup !
diff --git a/debian/tomcat6.cron.daily b/debian/tomcat6.cron.daily
index 016018c..a585050 100644
--- a/debian/tomcat6.cron.daily
+++ b/debian/tomcat6.cron.daily
@@ -2,11 +2,14 @@
 
 NAME=tomcat6
 DEFAULT=/etc/default/$NAME
+LOGEXT=log
 
 # The following variables can be overwritten in $DEFAULT
 
 # Default for number of days to keep old log files in /var/log/tomcatN/
 LOGFILE_DAYS=14
+# Whether to compress logfiles older than today's
+LOGFILE_COMPRESS=1
 
 # End of variables that can be overwritten in $DEFAULT
 
@@ -16,6 +19,12 @@ if [ -f "$DEFAULT" ]; then
 fi
 
 if [ -d /var/log/$NAME ]; then
-	find /var/log/$NAME/ -name \*.log -mtime +$LOGFILE_DAYS -print0 \
+	if [ $LOGFILE_COMPRESS = 1 ]; then
+		find /var/log/$NAME/ -name \*.$LOGEXT -daystart -mtime +0 -print0 \
+			| xargs --no-run-if-empty -0 gzip -9
+		LOGEXT=log.gz
+	fi
+
+	find /var/log/$NAME/ -name \*.$LOGEXT -mtime +$LOGFILE_DAYS -print0 \
 		| xargs --no-run-if-empty -0 rm --
 fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/tomcat6.git



More information about the pkg-java-commits mailing list