From 4a792d6fcdd1cfa37901640d0282b8979d493108 Mon Sep 17 00:00:00 2001
From: David Beniamine <david.beniamine@tetras-libre.fr>
Date: Mon, 30 Sep 2019 14:17:26 +0200
Subject: [PATCH] Actually do something on reboot

---
 wol/scripts/wakeonlanservice.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/wol/scripts/wakeonlanservice.sh b/wol/scripts/wakeonlanservice.sh
index fd035e1..d3aa387 100755
--- a/wol/scripts/wakeonlanservice.sh
+++ b/wol/scripts/wakeonlanservice.sh
@@ -99,5 +99,14 @@ do
         subactions="$(echo $LINE | sed -e 's/^upgrade//' -e 's/All//')"
         nohup $DIR/upgrade_all.sh $subactions &
         echo "Started 'upgrade_all.sh $subactions' in background on $(date)" | answer
+    elif [[ "$LINE" =~ "reboot" ]]
+    then
+        mac=$(echo $line | cut -d ' ' -f 2)
+        IPS=$(getip $mac | sed -e 's/ /,/g')
+        for $ip in $IPS
+        do
+            ssh $ip "reboot"
+        done
+        answer "Redémarrage demandé, attendez une à deux minutes avant d'essayer de vous connecter"
     fi
 done
-- 
GitLab