[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#979813: apache2.logrotate is crufty



Package: src:apache2
Version: 2.4.46
Severity: minor
Tags: patch

Debian Apache Maintainers,

apache2.logrotate is crufty, which makes it confusing to modify.

The attached patch does the following:
  1) Moves the prerotate script before the postrotate script
  2) Simplifies check of whether apache2 is running
  3) Removes crufty "> /dev/null", ";", and "\"
  4) Uses consistent four-space indentation

Thank you!
Daniel Lewart
Urbana, Illinois
--- apache2.logrotate.orig	2020-09-01 07:50:51.000000000 -0500
+++ apache2.logrotate	2021-01-11 00:00:00.000000000 -0600
@@ -1,20 +1,20 @@
 /var/log/apache2/*.log {
-	daily
-	missingok
-	rotate 14
-	compress
-	delaycompress
-	notifempty
-	create 640 root adm
-	sharedscripts
-	postrotate
-                if invoke-rc.d apache2 status > /dev/null 2>&1; then \
-                    invoke-rc.d apache2 reload > /dev/null 2>&1; \
-                fi;
-	endscript
-	prerotate
-		if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
-			run-parts /etc/logrotate.d/httpd-prerotate; \
-		fi; \
-	endscript
+    daily
+    missingok
+    rotate 14
+    compress
+    delaycompress
+    notifempty
+    create 640 root adm
+    sharedscripts
+    prerotate
+	if [ -d /etc/logrotate.d/httpd-prerotate ]; then
+	    run-parts /etc/logrotate.d/httpd-prerotate
+	fi
+    endscript
+    postrotate
+	if pgrep -f ^/usr/sbin/apache2 > /dev/null; then
+	    invoke-rc.d apache2 reload
+	fi
+    endscript
 }

Reply to: