<?php include_once dirname(__FILE__) . "/frame.class.inc"; include_once dirname(__FILE__) . "/class.unix.inc"; if (isset($_GET["status-instance"])) { status_instance(); exit; } if (isset($_GET["statrt"])) { status_instance_stats(); exit; } if (isset($_GET["start-instance"])) { start_instance(); exit; } if (isset($_GET["stop-instance"])) { stop_instance(); exit; } if (isset($_GET["restart-instance"])) { restart_instance(); exit; } if (isset($_GET["restart-instance-silent"])) { restart_instance_silent(); exit; } if (isset($_GET["build-instance"])) { build_instance(); exit;
function status() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = @file_get_contents($pidfile); $unix = new unix(); if ($unix->process_exists($pid, basename(__FILE__))) { echo "Starting......: load-balancer engine Already executed PID {$pid}...\n"; return; } @file_put_contents($pidfile, getmypid()); $sql = "SELECT * FROM crossroads_main WHERE enabled=1"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_backup"); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $f[] = status_instance($ligne["ID"]); } echo @implode("\n", $f); }