From d22277878254cf33fd63ca1bf12b215f4e030a27 Mon Sep 17 00:00:00 2001 From: Marius Burkard <m.burkard@pixcept.de> Date: Mon, 04 Jan 2016 05:12:49 -0500 Subject: [PATCH] - merged different fixes and updates from foreign branches --- 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