Example #1
0
}
$curl = new ccurl("https://{$hostname}:{$listen_port}/nodes.listener.php?PING=YES");
if ($send_listen_ip != null) {
    $curl->interface = $send_listen_ip;
}
$curlparms["listen_addr"] = $listen_addr;
$curl = new ccurl("https://{$hostname}:{$listen_port}/nodes.listener.php");
if ($send_listen_ip != null) {
    $curl->interface = $send_listen_ip;
}
$curlparms["listen_addr"] = $listen_addr;
$unix = new unix();
$curlparms["hostname"] = $unix->hostname_g();
$sql = "SELECT servername FROM freeweb";
$q = new mysql();
$results = $q->QUERY_SQL($sql, 'artica_backup');
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
    $curlparms["FREEWEBS_SRV"][$ligne["servername"]] = true;
}
@file_put_contents("/usr/share/artica-postfix/ressources/logs/web/com.txt", base64_encode(serialize($curlparms)));
$net = new netagent();
$net->compress("/usr/share/artica-postfix/ressources/logs/web/com.txt", "/usr/share/artica-postfix/ressources/logs/web/com.txt.gz");
@unlink("/usr/share/artica-postfix/ressources/logs/web/com.txt");
$curl->x_www_form_urlencoded = true;
if (!$curl->postFile("DNS_LINKER", "/usr/share/artica-postfix/ressources/logs/web/com.txt.gz", array("CREDS" => $EnableDNSLinkerCreds["CREDS"], "VERBOSE" => "TRUE"))) {
    echo "Posting informations Failed {$curl->error}...\n";
    @unlink("/usr/share/artica-postfix/ressources/logs/web/com.txt.gz");
}
if ($GLOBALS["VERBOSE"]) {
    echo $curl->data . "\n";
}
Example #2
0
function communicate()
{
    $unix = new unix();
    $sock = new sockets();
    $php = $unix->LOCATE_PHP5_BIN();
    $kill = $unix->find_program("kill");
    $GLOBALS["CLASS_SOCKET"] = $sock;
    $GLOBALS["CLASS_UNIX"] = $unix;
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, __FILE__)) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Remote stat appliance, Already running pid {$pid}\n";
        }
        if ($time < 10) {
            WriteMyLogs("Warning: Already running pid {$pid} since {$time}mn", __FUNCTION__, __FILE__, __LINE__);
            return;
        } else {
            unix_system_kill_force($pid);
        }
    }
    $GLOBALS["MYPID"] = getmypid();
    WriteMyLogs("New PID: " . getmypid());
    @file_put_contents($pidfile, getmypid());
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    if (!is_numeric($EnableRemoteStatisticsAppliance)) {
        $EnableRemoteStatisticsAppliance = 0;
    }
    if ($EnableRemoteStatisticsAppliance == 0) {
        if ($GLOBALS["VERBOSE"]) {
            WriteMyLogs("EnableRemoteStatisticsAppliance: {$EnableRemoteStatisticsAppliance} = 0");
            echo "EnableRemoteStatisticsAppliance: {$EnableRemoteStatisticsAppliance} = 0\n";
        }
        return;
    }
    if (!$GLOBALS["VERBOSE"]) {
        $time = $unix->file_time_min($pidTime);
        if ($time < 3) {
            writelogs("Accepted only betwee, 3mn each...", __FUNCTION__, __FILE__, __LINE__);
            return;
        }
    }
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    if ($GLOBALS["OUTPUT"]) {
        echo "Ping the remote appliance...\n";
    }
    $net = new netagent();
    WriteMyLogs("->ping()...");
    $net->ping();
}