Beispiel #1
0
 static function mysqlPasswordReset($pass)
 {
     lxshell_return("lphp.exe", "../bin/common/misc/reset-mysql-root-password.phps", $pass);
     sleep(20);
     exec_with_all_closed("service mysqld restart");
     sleep(50);
     $a['mysql']['dbpassword'] = $pass;
     slave_save_db("dbadmin", $a);
 }
 static function QueueDelete($list)
 {
     global $gbl, $sgbl, $login, $ghtml;
     foreach ($list as $f) {
         $string[] = "-d{$f}";
     }
     $string = implode(" ", $string);
     lxfile_unix_chmod("__path_program_root/bin/misc/qmHandle", "0755");
     exec_with_all_closed("{$sgbl->__path_program_root}/bin/misc/qmHandle {$string}");
 }
Beispiel #3
0
function update_from_master($rmt)
{
    global $gbl, $sgbl, $login, $ghtml;
    $ver = $rmt->version;
    //lxfile_rm("lib/gbl.php");
    //lxshell_return("cvs", "up");
    if (!lx_core_lock_check_only('update.php')) {
        exec_with_all_closed("{$sgbl->__path_php_path} ../bin/update.php --till-version={$ver}");
        //sleep(1);
    }
}
 function dbactionUpdate($subaction)
 {
     if (if_demo()) {
         throw new lxException("demo", $v);
     }
     if ($this->main->ssh_port && !($this->main->ssh_port > 0)) {
         throw new lxException('invalid_ssh_port', 'ssh_port', '');
     }
     dprint($this->main->ssh_port);
     $this->main->ssh_port = trim($this->main->ssh_port);
     if (!$this->main->ssh_port) {
         $port = "22";
     } else {
         $port = $this->main->ssh_port;
     }
     if (lxfile_exists("/etc/fedora-release")) {
         $str = lfile_get_contents("../file/template/sshd_config-fedora-2");
     } else {
         $str = lfile_get_contents("../file/template/sshd_config");
     }
     $str = str_replace("%ssh_port%", $port, $str);
     if ($this->main->isOn('without_password_flag')) {
         $wt = 'without-password';
     } else {
         $wt = 'yes';
     }
     if ($this->main->isOn('disable_password_flag')) {
         $pwa = 'no';
     } else {
         $pwa = 'yes';
     }
     $str = str_replace("%permit_root_login%", $wt, $str);
     $str = str_replace("%permit_password%", $pwa, $str);
     $ret = lfile_put_contents("/etc/ssh/sshd_config", $str);
     if (!$ret) {
         throw new lxException('could_not_write_config_file', '', '');
     }
     exec_with_all_closed("/etc/init.d/sshd restart");
 }
Beispiel #5
0
function checkRestart()
{
    if (if_demo()) {
        return;
    }
    $res = lscandir_without_dot("__path_program_etc/.restart");
    if ($res === false) {
        dprint(".restart does not exist... Creating\n");
        lxfile_mkdir("__path_program_etc/.restart");
        lxfile_generic_chown("__path_program_etc/.restart", "lxlabs");
    }
    foreach ((array) $res as $r) {
        if (csb($r, "._restart_")) {
            $cmd = strfrom($r, "._restart_");
        }
        lunlink("__path_program_etc/.restart/{$r}");
        dprint("Restarting {$cmd}\n");
        // THe 3,4 etc are the tcp ports of this program, and it should be closed, else some programs will grab it.
        //exec("/etc/init.d/$cmd restart  </dev/null >/dev/null 2>&1 3</dev/null 4</dev/null 5</dev/null 6</dev/null &");
        switch ($cmd) {
            case 'lxcollectquota':
                exec_justdb_collectquota();
                break;
            case 'openvz_tc':
                exec_openvz_tc();
                break;
            default:
                exec_with_all_closed("/etc/init.d/{$cmd} restart");
                break;
        }
    }
}
Beispiel #6
0
function checkRestart()
{
    if (if_demo()) {
        return;
    }
    log_log("cron_exec", "Check service restarts...\n");
    $res = lscandir_without_dot("__path_program_etc/.restart");
    if ($res === false) {
        dprint(".restart does not exist... Creating\n");
        lxfile_mkdir("__path_program_etc/.restart");
        lxfile_generic_chown("__path_program_etc/.restart", "lxlabs");
    }
    foreach ((array) $res as $r) {
        if (csb($r, "._restart_")) {
            $cmd = strfrom($r, "._restart_");
        }
        lunlink("__path_program_etc/.restart/{$r}");
        dprint("Restarting {$cmd}\n");
        switch ($cmd) {
            case 'lxcollectquota':
                log_log("cron_exec", "Start collecting Quota's\n");
                exec_justdb_collectquota();
                break;
            case 'openvz_tc':
                log_log("cron_exec", "Start openvz_tc script\n");
                exec_openvz_tc();
                break;
            default:
                log_log("cron_exec", "Restarting {$cmd}\n");
                exec_with_all_closed("/etc/init.d/{$cmd} restart");
                break;
        }
    }
}
Beispiel #7
0
function restart_service($service)
{
    exec_with_all_closed("service {$service} restart >/dev/null 2>&1");
}
Beispiel #8
0
function os_restart_program()
{
    global $gbl, $sgbl, $login, $ghtml;
    $pgm = $sgbl->__var_program_name;
    // We just need to kill the main server, and leave the wrapper alone.
    exec_with_all_closed("/etc/init.d/{$pgm} lxrestart");
}
 function startStopService($act)
 {
     global $gbl, $sgbl, $login, $ghtml;
     exec_with_all_closed("{$sgbl->__path_real_etc_root}/init.d/{$this->main->servicename} {$act}");
 }