Esempio n. 1
0
function CheckInstances()
{
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    if ($unix->process_exists(@file_get_contents($pidfile))) {
        echo "Starting......: " . date("H:i:s") . " CheckInstances function already executed PID " . @file_get_contents($pidfile) . "\n";
        die;
    }
    $pid = getmypid();
    echo "Starting......: " . date("H:i:s") . " CheckInstances configurator running {$pid}\n";
    file_put_contents($pidfile, $pid);
    $maincf = new maincf_multi("");
    $maincf->PostfixMainCfDefaultInstance();
    $sql = "SELECT `value` FROM postfix_multi WHERE `key`='myhostname' GROUP BY `value`";
    echo "Starting......: " . date("H:i:s") . " Postfix activate HUB(s)\n";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $myhostname = trim($ligne["value"]);
        if ($myhostname == null) {
            continue;
        }
        if ($myhostname == "master") {
            continue;
        }
        echo "Starting......: " . date("H:i:s") . " Postfix \"{$myhostname}\" checking HUB\n";
        ConfigureMainCF($myhostname);
    }
    @unlink($pidfile);
}
Esempio n. 2
0
function CheckInstances()
{
    $maincf = new maincf_multi("");
    $maincf->PostfixMainCfDefaultInstance();
    $sql = "SELECT `value` FROM postfix_multi WHERE `key`='myhostname' GROUP BY `value`";
    echo "Starting......: Postfix activate HUB(s)\n";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $myhostname = trim($ligne["value"]);
        if ($myhostname == null) {
            continue;
        }
        echo "Starting......: Postfix checking HUB {$myhostname}\n";
        ConfigureMainCF($myhostname);
    }
}