array ("request", "string", ''), "script" => array ("request", "boolean", 0), ); getFields($fields); if (in_array($action, array('start', 'stop', 'monit'))) { $res = $hooks->invoke($action, array(), 'lxc'); } switch ($action) { case "start": $lxc->start(); break; case "stop": $lxc->stop(); break; } if ($lxc->error && !$script) { $error=$lxc->error; } $infos = $lxc->getvm(); if ($script) { header("Content-Type: text/plain"); if (isset($res)) { echo "ACTION:".$action."\n"; echo "RETURN:".intval($res['lxc'])."\n"; } if ($infos) { echo "VM_STATUS:OK\n"; echo "VM_START:".$infos['starttime']."\n"; echo "VM_HOSTNAME:".$infos['hostname']."\n"; foreach($infos['ssh-keys'] as $k) if (trim($k)) echo "VM_SSHKEY:".trim($k)."\n"; } else { echo "VM_STATUS:NONE\n"; } die(); } # Show the header after the "if script" ;) include_once("head.php"); ?>
"; echo "ssh ".$mem->user['login']."@".$infos['hostname']."\n"; echo "rsync ".$mem->user['login']."@".$infos['hostname']."\n"; echo "