From a4e127a6af97041b2c067f888f8c73a8aec682f1 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Mon, 04 Jan 2016 05:29:53 -0500
Subject: [PATCH] Merge branch 'mergebranch' into 'master'
---
server/mods-available/web_module.inc.php | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/server/mods-available/web_module.inc.php b/server/mods-available/web_module.inc.php
index 42eaab6..36e1391 100644
--- a/server/mods-available/web_module.inc.php
+++ b/server/mods-available/web_module.inc.php
@@ -216,13 +216,31 @@
} else {
$cmd = $app->system->getinitcommand($daemon, 'reload');
}
+
+ if($web_config['server_type'] == 'nginx'){
+ $app->log("Checking nginx configuration...", LOGLEVEL_DEBUG);
+ exec('nginx -t 2>&1', $retval['output'], $retval['retval']);
+ if($retval['retval'] == 0){
+ $app->log("nginx configuration ok!", LOGLEVEL_DEBUG);
+ } else {
+ $app->log("nginx config test failed!", LOGLEVEL_DEBUG);
+ return $retval;
+ }
+ }
+
exec($cmd.' 2>&1', $retval['output'], $retval['retval']);
+
+ // if restart failed despite successful syntax check => try again
+ if($web_config['server_type'] == 'nginx' && $retval['retval'] > 0){
+ sleep(2);
+ exec($cmd.' 2>&1', $retval['output'], $retval['retval']);
+ }
$app->log("Restarting httpd: $cmd", LOGLEVEL_DEBUG);
// nginx: do a syntax check because on some distributions, the init script always returns 0 - even if the syntax is not ok (how stupid is that?)
- if($web_config['server_type'] == 'nginx' && $retval['retval'] == 0){
- exec('nginx -t 2>&1', $retval['output'], $retval['retval']);
- }
+ //if($web_config['server_type'] == 'nginx' && $retval['retval'] == 0){
+ //exec('nginx -t 2>&1', $retval['output'], $retval['retval']);
+ //}
return $retval;
}
--
Gitblit v1.9.1