From 287d0b67bd693ae5f9c4764532f23d83851c19b3 Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Tue, 13 Nov 2012 10:31:55 -0500
Subject: [PATCH] Updated: apache2 restart check extended for long-lasting restarts

---
 server/plugins-available/apache2_plugin.inc.php |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 19266c5..14caf6e 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -1389,10 +1389,14 @@
 			$app->services->restartService('httpd','restart');
 			
 			// wait a few seconds, before we test the apache status again
+			$apache_online_status_after_restart = false;
 			sleep(2);
-		
+			for($i = 0; $i < 5; $i++) {
+				$apache_online_status_after_restart = $this->_checkTcp('localhost',80);
+				if($apache_online_status_after_restart) break;
+				sleep(1);
+			}
 			//* Check if apache restarted successfully if it was online before
-			$apache_online_status_after_restart = $this->_checkTcp('localhost',80);
 			$app->log('Apache online status after restart is: '.$apache_online_status_after_restart,LOGLEVEL_DEBUG);
 			if($apache_online_status_before_restart && !$apache_online_status_after_restart) {
 				$app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the configuration. Saved non-working config as '.$vhost_file.'.err',LOGLEVEL_WARN);

--
Gitblit v1.9.1