3 require_once(
"../class/config.php");
6 "action" => array (
"request",
"string",
''),
7 "script" => array (
"request",
"boolean", 0),
11 if (in_array($action, array(
'start',
'stop',
'monit'))) {
12 $res =
$hooks->invoke($action, array(),
'lxc');
22 if ($lxc->error && !$script) {
29 header(
"Content-Type: text/plain");
31 echo
"ACTION:".$action.
"\n";
32 echo
"RETURN:".intval(
$res[
'lxc']).
"\n";
35 echo
"VM_STATUS:OK\n";
36 echo
"VM_START:".$infos[
'starttime'].
"\n";
37 echo
"VM_HOSTNAME:".$infos[
'hostname'].
"\n";
38 foreach(
$infos[
'ssh-keys'] as $k)
40 echo
"VM_SSHKEY:".trim($k).
"\n";
42 echo
"VM_STATUS:NONE\n";
47 # Show the header after the "if script" ;)
48 include_once(
"head.php");
52 <h3><?php
__(
'Console access'); ?></h3>
56 <?php
if (!empty(
$error)) { ?>
58 <span
class=
"alert alert-danger">
59 <?php echo implode(
" - ", array_unique(
$error)); ?>
69 <p
class=
"alert alert-info"><?php
__(
"You can start a virtual machine."); ?></p>
70 <form method=
"post" action=
"vm.php">
71 <input type=
"hidden" name=
"action" value=
"start" />
72 <input type=
"submit" class=
"inb ok" name=
"go" value=
"<?php __("Click here to start a
virtual machine.
"); ?>" />
76 echo
"<table class='tedit'>";
77 echo
"<tr><th>"._(
"Hostname").
"</th><td>".
$infos[
'hostname'].
"</td></tr>";
78 echo
"<tr><th>"._(
"Start time").
"</th><td>".date(
'Y-m-d H:i:s',
$infos[
'starttime']).
"</td></tr>";
79 echo
"<tr><th>"._(
"SSH Fingerprint").
"</th><td style=\"font-family: Courier, fixed;\">".implode(
'<br />',
$infos[
'ssh-keys']).
"</td></tr>";
80 echo
"<tr><th>"._(
"Useful command").
"</th><td><pre>";
81 echo
"ssh ".$mem->user[
'login'].
"@".
$infos[
'hostname'].
"\n";
82 echo
"rsync ".$mem->user[
'login'].
"@".
$infos[
'hostname'].
"\n";
83 echo
"</pre></td></tr>";
86 <p
class=
"alert alert-info"><?php
__(
"You can stop your virtual machine."); ?></p>
87 <form method=
"post" action=
"vm.php">
88 <input type=
"hidden" name=
"action" value=
"stop" />
89 <input type=
"submit" class=
"inb cancel" name=
"go" value=
"<?php __("Click here to stop your running
virtual machine.
"); ?>" />
99 <h3><?php
__(
"Tips"); ?></h3>
101 <div
id=
"tabs-tips-vm">
104 <li
class=
"help"><a href=
"#tabs-tips-soft"><?php
__(
"Available softwares"); ?></a></li>
105 <li
class=
"help"><a href=
"#tabs-tips-script"><?php
__(
"Remotely start/stop a VM"); ?></a></li>
109 <div
id=
'tabs-tips-script'>
110 <?php
__(
"You can script the launch the console access in command line by using this url:"); ?>
112 <?php
__(
"You can halt the vm by using:"); ?>
114 <?php
__(
"And you can see existing vm information (if the vm is running) by using:"); ?>
116 <i><?php
__(
"Warning: if you do not use HTTPS, your password will be transfered without any protection"); ?></i>
119 <div
id=
'tabs-tips-soft'>
120 <?php
__(
"To access a remote console with SSH, you can use Putty.");?>
122 <?php
__(
"To transfer files, you can use Filezilla in SFTP mode."); ?>
125 </div><!-- tabs-tips-
vm -->
127 <script type=
"text/javascript">
128 $(
function() {$(
"#tabs-tips-vm" ).tabs();});
132 include_once(
"foot.php");