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

Bug#711117: Fwd: Anacron job 'cron.daily' on tglase.lan.tarent.de



tags 711117 + patch
thanks

Hi,

please see the attached patch. (The initscript is ugly,
but I tried to keep the changes relatively minimal.)

bye,
//mirabilos
-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-314
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Boris Esser, Sebastian Mancke

---------- Forwarded message ----------
From: Anacron <root@tglase.lan.tarent.de>
Message-ID: <20130602053545.90C13702AB1@tglase.lan.tarent.de>
To: root@tglase.lan.tarent.de
Date: Sun,  2 Jun 2013 07:35:45 +0200 (CEST)
Subject: Anacron job 'cron.daily' on tglase.lan.tarent.de

/etc/cron.daily/logrotate:
error: error running shared postrotate script for '/var/log/apache2/*.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1
From b47a2167c32559885d7cff6d72f83301aa67bfc6 Mon Sep 17 00:00:00 2001
From: Thorsten Glaser <tg@debian.org>
Date: Wed, 5 Jun 2013 11:04:59 +0200
Subject: [PATCH] The init script exits 0 unless an error occured. Closes:
 #711117

Signed-off-by: Thorsten Glaser <tg@debian.org>
---
 debian/apache2.init | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/debian/apache2.init b/debian/apache2.init
index a9f215f..78f84cc 100755
--- a/debian/apache2.init
+++ b/debian/apache2.init
@@ -206,7 +206,9 @@ do_stop()
 # Function that sends a SIGHUP to the daemon/service
 #
 do_reload() {
-        if $APACHE2CTL configtest > /dev/null 2>&1; then
+	$APACHE2CTL configtest >/dev/null 2>&1
+	APACHE2_INIT_CONFIGTEST_STATUS=$?
+	if test $APACHE2_INIT_CONFIGTEST_STATUS = 0; then
 	        if ! pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then
                         APACHE2_INIT_MESSAGE="Apache2 is not running"
                         return 2
@@ -282,6 +284,7 @@ case "$1" in
                         [ "$VERBOSE" != no ] && log_end_msg 1
                         [ -n "$APACHE2_INIT_MESSAGE" ] && echo $APACHE2_INIT_MESSAGE >&2
                         log_failure_msg
+			exit 1
                ;;
 	esac
 	;;
@@ -305,15 +308,25 @@ case "$1" in
                 [ "$VERBOSE" != no ] && log_end_msg $?
         fi
 
+	case $RET_STATUS in
+	(0|1)
+		;;
+	(*)
+		exit 1
+		;;
+	esac
+
 	;;
   status)
-	status_of_proc -p $PIDFILE "apache2" "$NAME" && exit 0 || exit $?
+	status_of_proc -p $PIDFILE "apache2" "$NAME"
+	exit $?
 	;;
   reload|force-reload|graceful)
 	log_daemon_msg "Reloading $DESC" "$NAME"
 	do_reload
 	log_end_msg $?
         [ "$VERBOSE" != no ] && [ "x$APACHE2_INIT_MESSAGE" != "x" ] && log_warning_msg "$APACHE2_INIT_MESSAGE"
+	test $APACHE2_INIT_CONFIGTEST_STATUS = 0 || exit 1
 	;;
   restart)
 	log_daemon_msg "Restarting $DESC" "$NAME"
@@ -322,14 +335,15 @@ case "$1" in
 	  0|1)
 		do_start
 		case "$?" in
-			0) log_end_msg 0 ;;
-			1) log_end_msg 1 ;; # Old process is still running
-			*) log_end_msg 1 ;; # Failed to start
+		0) log_end_msg 0 ;;
+		1) log_end_msg 1; exit 1 ;; # Old process is still running
+		*) log_end_msg 1; exit 1 ;; # Failed to start
 		esac
 		;;
 	  *)
 		# Failed to stop
 		log_end_msg 1
+		exit 1
 		;;
 	esac
 	;;
@@ -348,3 +362,4 @@ case "$1" in
 	exit 3
 	;;
 esac
+exit 0
-- 
1.8.3


Reply to: