diff --git a/wol/scripts/wakeonlanservice.sh b/wol/scripts/wakeonlanservice.sh
index e4dfeabe2bb319739ab0f614642f57d0fb7e4cf0..f1d9b48887ea9296c258e00298137dbbea9ca497 100755
--- a/wol/scripts/wakeonlanservice.sh
+++ b/wol/scripts/wakeonlanservice.sh
@@ -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
diff --git a/wol/www/index.php b/wol/www/index.php
index abb247ed67d36b542b910974e2cbf5bd95c99850..e6f1b21e418ac7df415ac70fba5e7b0cc5807c7c 100644
--- a/wol/www/index.php
+++ b/wol/www/index.php
@@ -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) ;
             }