mcramer
2012-11-13 287d0b67bd693ae5f9c4764532f23d83851c19b3
Updated: apache2 restart check extended for long-lasting restarts

1 files modified
8 ■■■■ changed files
server/plugins-available/apache2_plugin.inc.php 8 ●●●● patch | view | raw | blame | history
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);