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

Add some timeouts

parent 23314a35
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@ getip(){
IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1)
broadcast=$(ip a | awk '/inet.*eth1/ {print $4}' | cut -d / -f 1)
subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3)
LIMIT=20
while true
do
MAC=`netcat -l $IP 9999`
......@@ -31,11 +32,18 @@ do
then
wakeonlan -i $broadcast "$MAC"
bootedip=""
timeout=0
sleep 25
while [ -z "$bootedip" ]
do
bootedip=`getip $MAC`
sleep 5
timeout=$(($timeout +1))
if [ $timeout -ge $LIMIT ]
then
$bootedip="ERROR"
break
fi
done
echo "$bootedip" | netcat $subnet.51 9999
fi
......
......@@ -41,6 +41,12 @@
data: '<?php echo "mac=$mac"?>',
url: 'boot.php',
timeout: 120000,
error: function(reponse){
if(textStatus === 'timeout')
{
alert('Erreur : timeout');
}
},
success: function(response) {
$("#result").html(response) ;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment