ftimme
2011-10-17 7e040dd03c3aaa76f594a4447c42f7a8da54dad3
- Server Config > Rescue tab: Replaced Apache monitoring with HTTPD monitoring to include nginx.
6 files modified
46 ■■■■■ changed files
install/tpl/server.ini.master 2 ●●● patch | view | raw | blame | history
interface/web/admin/form/server_config.tform.php 2 ●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/de_server_config.lng 10 ●●●● patch | view | raw | blame | history
interface/web/admin/lib/lang/en_server_config.lng 4 ●●●● patch | view | raw | blame | history
interface/web/admin/templates/server_config_rescue_edit.htm 4 ●●●● patch | view | raw | blame | history
server/mods-available/rescue_core_module.inc.php 24 ●●●●● patch | view | raw | blame | history
install/tpl/server.ini.master
@@ -102,7 +102,7 @@
[rescue]
try_rescue=n
do_not_try_rescue_apache=n
do_not_try_rescue_httpd=n
do_not_try_rescue_mysql=n
do_not_try_rescue_mail=n
interface/web/admin/form/server_config.tform.php
@@ -1045,7 +1045,7 @@
            'default' => 'n',
            'value' => array(0 => 'n', 1 => 'y')
        ),
        'do_not_try_rescue_apache' => array(
        'do_not_try_rescue_httpd' => array(
            'datatype' => 'VARCHAR',
            'formtype' => 'CHECKBOX',
            'default' => 'n',
interface/web/admin/lib/lang/de_server_config.lng
@@ -143,10 +143,10 @@
$wb['php_fpm_socket_dir_error_empty'] = 'PHP-FPM Socket-Verzeichnis ist leer.';
$wb['fastcgi_config_syntax_txt'] = 'FastCGI config syntax';
$wb['backup_dir_ftpread_txt'] = 'Backup dir. readable for website FTP users.';
$wb['try_rescue_txt'] = 'Enable service monitoring and restart on failure';
$wb['do_not_try_rescue_apache_txt'] = 'Disable apache monitoring';
$wb['do_not_try_rescue_mysql_txt'] = 'Disable MySQL monitoring';
$wb['do_not_try_rescue_mail_txt'] = 'Disable Email monitoring';
$wb['rescue_description_txt'] = '<b>Information:</b> If you want to shut down mysql you have to select the Disable MySQL monitor checkbox and then wait 2-3 minutes.<br>if you do not wait 2-3 minutes, rescue will try to restart mysql!';
$wb['try_rescue_txt'] = 'Aktiviere Service Monitoring und Neustart bei Unerreichbarkeit';
$wb['do_not_try_rescue_httpd_txt'] = 'Deaktiviere HTTPD Monitoring';
$wb['do_not_try_rescue_mysql_txt'] = 'Deaktiviere MySQL Monitoring';
$wb['do_not_try_rescue_mail_txt'] = 'Deaktiviere Email Monitoring';
$wb['rescue_description_txt'] = '<b>Information:</b> Falls Sie MySQL stoppen m&ouml;chten, w&auml;hlen Sie die &quot;Deaktiviere MySQL Monitoring&quot; Checkbox und warten Sie 2-3 Minuten.<br>Falls Sie nicht 2-3 Minuten warten, wird Rescue versuchen, MySQL neu zu starten!';
$wb['enable_sni_txt'] = 'Enable SNI';
?>
interface/web/admin/lib/lang/en_server_config.lng
@@ -144,10 +144,10 @@
$wb["php_fpm_socket_dir_txt"] = 'PHP-FPM socket directory';
$wb["php_fpm_socket_dir_error_empty"] = 'PHP-FPM socket directory is empty.';
$wb["try_rescue_txt"] = 'Enable service monitoring and restart on failure';
$wb["do_not_try_rescue_apache_txt"] = 'Disable apache monitoring';
$wb["do_not_try_rescue_httpd_txt"] = 'Disable HTTPD monitoring';
$wb["do_not_try_rescue_mysql_txt"] = 'Disable MySQL monitoring';
$wb["do_not_try_rescue_mail_txt"] = 'Disable Email monitoring';
$wb["rescue_description_txt"] = '<b>Information:</b> If you want to shut down mysql you have to select the "Disable MySQL monitor" checkbox and then wait 2-3 minutes.<br>if you do not wait 2-3 minutes, rescue will try to restart mysql!';
$wb["rescue_description_txt"] = '<b>Information:</b> If you want to shut down mysql you have to select the "Disable MySQL monitor" checkbox and then wait 2-3 minutes.<br>If you do not wait 2-3 minutes, rescue will try to restart mysql!';
$wb["enable_sni_txt"] = 'Enable SNI';
?>
interface/web/admin/templates/server_config_rescue_edit.htm
@@ -12,9 +12,9 @@
                    </div>
            </div>
      <div class="ctrlHolder">
                <p class="label" style="width:300px">{tmpl_var name='do_not_try_rescue_apache_txt'}</p>
                <p class="label" style="width:300px">{tmpl_var name='do_not_try_rescue_httpd_txt'}</p>
                    <div class="multiField" style="width:100px">
                        {tmpl_var name='do_not_try_rescue_apache'}
                        {tmpl_var name='do_not_try_rescue_httpd'}
                    </div>
            </div>
      <div class="ctrlHolder">
server/mods-available/rescue_core_module.inc.php
@@ -89,14 +89,14 @@
        $this->_rescueData = $this->_getRescueData();
        
        /*
         * rescue mysql if needed (maybe apache depends on mysql, so try this first!)
         * rescue mysql if needed (maybe httpd depends on mysql, so try this first!)
         */
        $this->_rescueMySql();
        
        /*
         * rescue apache if needed
         * rescue httpd if needed
         */
        $this->_rescueApache();
        $this->_rescueHttpd();
        
        /*
         * The last step is to save the rescue-data
@@ -218,15 +218,15 @@
    }
    /**
     * restarts apache, if needed
     * restarts httpd, if needed
     */
    private function _rescueApache(){
    private function _rescueHttpd(){
        global $app, $conf;
        
        /*
         * do nothing, if it is not allowed to rescue apache
         * do nothing, if it is not allowed to rescue httpd
         */
        if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_apache']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_apache']) == 'y')){
        if ((isset($conf['serverconfig']['rescue']['do_not_try_rescue_httpd']) && ($conf['serverconfig']['rescue']['do_not_try_rescue_httpd']) == 'y')){
            return;
        }
        
@@ -267,18 +267,24 @@
        
        /* if 5 times will not work, we have to give up... */
        if ($tryCount > 5){
            $app->log('Apache is down! Rescue will not help!', LOGLEVEL_ERROR);
            $app->log('httpd is down! Rescue will not help!', LOGLEVEL_ERROR);
            return;
        }
        
        
        $app->log('Apache is down! Try rescue apache (try:' . $tryCount . ')...', LOGLEVEL_WARN);
        $app->log('httpd is down! Try rescue httpd (try:' . $tryCount . ')...', LOGLEVEL_WARN);
        if($conf['serverconfig']['web']['server_type'] == 'nginx'){
            $daemon = 'nginx';
        } else {
        if(is_file($conf['init_scripts'] . '/' . 'httpd')) {
            $daemon = 'httpd';
            } elseif(is_file($conf['init_scripts'] . '/' . 'httpd2')){
                $daemon = 'httpd2';
        } else {
            $daemon = 'apache2';
        }
        }
        
        $this->_rescueDaemon($daemon);
    }