diff --git a/wol/scripts/sendmac.sh b/wol/scripts/sendmac.sh index 9a8d20610e27d00d47ed6a10692ae011c68ceb2c..168daed23119287eb7eff0d2b3c326d338aba57c 100755 --- a/wol/scripts/sendmac.sh +++ b/wol/scripts/sendmac.sh @@ -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" diff --git a/wol/scripts/wakeonlanservice.sh b/wol/scripts/wakeonlanservice.sh index 4a055909bb51b1300536bf4c6b172279ac4f7d15..f08690bac3e1b69877cc47f56b07d3d03668cc51 100755 --- a/wol/scripts/wakeonlanservice.sh +++ b/wol/scripts/wakeonlanservice.sh @@ -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 - bootedip=`getip $MAC` + while [ -z "$bootedip" ] + do + bootedip=`getip $MAC` + sleep 5 + done echo "$bootedip" | netcat $subnet.51 9999 fi done diff --git a/wol/www/index.php b/wol/www/index.php index b4e28303d81eaabe2654707ab5616c4667df5457..e14c11131cd48ec30d512bd08fbc5add81cf3bfb 100644 --- a/wol/www/index.php +++ b/wol/www/index.php @@ -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">