function MultiplesInstances_stop($hostname)
{
    $unix = new unix();
    $pid = MultiplesInstancesPID($hostname);
    if (!$unix->process_exists($pid)) {
        echo "{$GLOBALS["deflog_sstop"]} {$hostname} already stopped\n";
        return;
    }
    echo "{$GLOBALS["deflog_sstop"]} {$hostname} stopping pid {$pid}\n";
    unix_system_kill($pid);
    for ($i = 0; $i < 20; $i++) {
        $pid = MultiplesInstancesPID($hostname);
        if (!$unix->process_exists($pid)) {
            echo "{$GLOBALS["deflog_sstop"]} {$hostname} stopped\n";
            break;
        }
        echo "{$GLOBALS["deflog_sstop"]} {$hostname} waiting pid {$pid}\n";
        if ($unix->process_exists($pid)) {
            unix_system_kill_force($pid);
            sleep(1);
            continue;
        }
        break;
    }
}
示例#2
0
function MultiplesInstances_stop($hostname)
{
    $unix = new unix();
    $pid = MultiplesInstancesPID($hostname);
    if (!$unix->process_exists($pid)) {
        echo "Stopping milter-greylist.....: {$hostname} already stopped\n";
        return;
    }
    echo "Stopping milter-greylist.....: {$hostname} stopping pid {$pid}\n";
    system("/bin/kill {$pid}");
    for ($i = 0; $i < 20; $i++) {
        $pid = MultiplesInstancesPID($hostname);
        if (!$unix->process_exists($pid)) {
            echo "Stopping milter-greylist.....: {$hostname} stopped\n";
            break;
        }
        echo "Stopping milter-greylist.....: {$hostname} waiting pid {$pid}\n";
        if ($unix->process_exists($pid)) {
            exec("/bin/kill {$pid} 2>&1", $results);
            if (preg_match("#No such process#", @implode(" ", $results))) {
                echo "Stopping milter-greylist.....: {$hostname} stopped\n";
                break;
            }
        }
        sleep(1);
    }
}