exit; } if (isset($_GET["lxc-ps"])) { lxc_ps(); exit; } if (isset($_GET["vps-restart"])) { vps_restart(); exit; } if (isset($_GET["vps-stop"])) { vps_stop(); exit; } if (isset($_GET["vps-start"])) { vps_start(); exit; } if (isset($_GET["vps-running"])) { vps_running(); exit; } if (isset($_GET["lxc-events"])) { lxc_events(); exit; } if (isset($_GET["vps-reconfig"])) { lxc_reconfig(); exit; } if (isset($_GET["lxc-templates"])) {
function duplicate_vps($from_id, $to_id) { $q = new mysql(); $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$from_id}.{$to_id}.pid"; $pid = @file_get_contents($pidfile); $unix = new unix(); if ($unix->process_exists($pid)) { echo2("Starting......: VPS server: vps-{$to_id}: Already instance executed {$pid}"); return; } $pid = getmypid(); @file_put_contents($pidfile, $pid); $q->QUERY_SQL("UPDATE lxc_machines SET `state`='configure' WHERE ID='{$to_id}'", "artica_backup"); $source_dir = root_directory($from_id); $destdir = root_directory($to_id); @mkdir($destdir); echo2("Starting......: VPS server: vps-{$to_id}: copying {$source_dir} to {$source_dir}"); shell_exec("/bin/cp -rf {$source_dir}/* {$destdir}/"); buildconfig($to_id); $q->QUERY_SQL("UPDATE lxc_machines SET `state`='installed' WHERE ID='{$to_id}'", "artica_backup"); vps_start($to_id); }