Exemplo n.º 1
0
function restart()
{
    if (!is_run()) {
        echo "Starting......: " . date("H:i:s") . " WINBIND (restart) not running, start it...\n";
        Winbindd_events("Winbindd (restart) not running, start it", __FUNCTION__, __LINE__);
        start(true);
        return;
    }
    $unix = new unix();
    $php5 = $unix->LOCATE_PHP5_BIN();
    $filetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $time = $unix->file_time_min($filetime);
    Winbindd_events("Winbindd ask to restart since {$time}Mn", __FUNCTION__, __LINE__);
    if (!$GLOBALS["FORCE"]) {
        if ($time < 59) {
            $pid = WINBIND_PID();
            if ($unix->process_exists($pid)) {
                $timepid = $unix->PROCESS_TTL($pid);
                echo "Starting......: " . date("H:i:s") . " WINBIND ask to restart need to wait 60Mn pid:{$pid} {$timepid}\n";
                Winbindd_events("Winbindd ask to restart need to wait 60Mn pid:{$pid} {$timepid}", __FUNCTION__, __LINE__);
                return;
            } else {
                echo "Starting......: " . date("H:i:s") . " WINBIND (restart) not running, start it...\n";
                shell_exec("{$php5} /usr/share/artica-postfix/exec.winbindd.php --start");
            }
        }
    }
    @unlink($filetime);
    @file_put_contents($filetime, time());
    $smbcontrol = $unix->find_program("smbcontrol");
    $chmod = $unix->find_program("chmod");
    $settings = new settings_inc();
    DirsPrivileges();
    if (!$GLOBALS["FORCE"]) {
        if (is_file($smbcontrol)) {
            Winbindd_events("Winbindd reloading", __FUNCTION__, __LINE__);
            echo "Starting......: " . date("H:i:s") . " WINBIND reloading...\n";
            shell_exec("{$smbcontrol} winbindd reload-config");
            shell_exec("{$smbcontrol} winbindd offline");
            shell_exec("{$smbcontrol} winbindd online");
            setfacl_squid();
            return;
        }
    }
    Winbindd_events("Winbindd stop", __FUNCTION__, __LINE__);
    stop();
    Winbindd_events("Winbindd ask to start", __FUNCTION__, __LINE__);
    start(true);
}
Exemplo n.º 2
0
function is_winbind_run()
{
    $unix = new unix();
    $pid = WINBIND_PID();
    if (!$unix->process_exists($pid)) {
        return false;
    }
    return true;
}