Skip to content
Snippets Groups Projects
Verified Commit e68f6698 authored by David Beniamine's avatar David Beniamine
Browse files

Async boot with output on the flow

parent 6a91ed84
No related branches found
No related tags found
No related merge requests found
......@@ -18,5 +18,8 @@
IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1)
subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3)
echo "Demande de démarrage pour l'adresse mac : $1"
echo "$1" | netcat $subnet.52 9999
netcat -l $IP 9999
echo "Démarrage en cours, attente de l'IP"
retip=`netcat -l $IP 9999`
echo "Vous pouvez désormais lancer XRDP et vous connecter à l'adresse : $retip"
......@@ -30,8 +30,13 @@ netcat -k -l $IP 9999 | \
if [ $(echo "$MAC" | egrep -c "^([0-9a-f]{2}:?){6}$") -eq 1 ]
then
wakeonlan -i $broadcast "$MAC"
$bootedip=""
sleep 30
while [ -z "$bootedip" ]
do
bootedip=`getip $MAC`
sleep 5
done
echo "$bootedip" | netcat $subnet.51 9999
fi
done
......
......@@ -32,7 +32,23 @@
if (strcmp($cmd, "")){
//echo "<p>execution de ' $cmd $args '</p>";
//echo "<p>".shell_exec("$cmd $args")."</p>";
echo "<p> Vous pouvez ouvrir XRDP et vous connecter à l'IP : <code>".shell_exec("$cmd $args")."</code></p>";
echo "<p> Demarrage de la machine ".$args."</p>";
echo "<pre><code>";
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("pipe", "w") // stderr is a pipe that the child will write to
);
flush();
$process = proc_open("$cmd $args", $descriptorspec, $pipes, realpath('./'), array());
echo "<pre>";
if (is_resource($process)) {
while ($s = fgets($pipes[1])) {
print $s;
flush();
}
}
echo "</code></pre>";
}
?>
<div id="box">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment