From 982ecf51180bb692c23de7251019f6c6ef7c5a5d Mon Sep 17 00:00:00 2001 From: nelson Date: Tue, 3 Jun 2025 11:31:28 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20Wake=20On=20LAN=20sur=20le=20sous?= =?UTF-8?q?=20r=C3=A9seau=20local=20de=20la=20salle=20et=20am=C3=A9liorati?= =?UTF-8?q?on=20du=20.env.exemple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.exemple | 22 +++++++++++++++++++++- reinitialisation_salle.sh | 16 ++++++++-------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.env.exemple b/.env.exemple index 371e66a..76531e7 100644 --- a/.env.exemple +++ b/.env.exemple @@ -1,2 +1,22 @@ +#Token d'API et d'Utilisateur FOG +FOG_USER_TOKEN="" FOG_API_TOKEN="" -FOG_USER_TOKEN"" + + +#Adresse IP de broadcast local de la salle (si la salle est en 192.168.106.0/24 -> Entrez 192.168.106.255) +LOCAL_BROADCAST_IP=192.168.xxx.255 + + +#Configuration des paramètres de la tâche + +#ID du groupe sur lequel déployer l'image +GROUP_ID="1" + +#ID de l'image a déployer +IMAGE_ID="1" + +#Type de déploiement (1 pour du multicast) +TASK_TYPE="1" + +#Éteindre les PCs à la fin (mettre à 1 ou 0) +SHUTDOWN="1" diff --git a/reinitialisation_salle.sh b/reinitialisation_salle.sh index 6515f20..72bcfac 100755 --- a/reinitialisation_salle.sh +++ b/reinitialisation_salle.sh @@ -13,11 +13,6 @@ if [ "$confirmation" == "o" ]; then echo "Lancement de la tâche de réinitialisation de la salle" - #Configuration - GROUP_ID="1" - IMAGE_ID="1" - TASK_TYPE="1" # Multicast - SHUTDOWN="1" # Éteindre à la fin #Récupération des MAC des PCs MACS=$(curl -s -H "fog-api-token: $FOG_API_TOKEN" -H "fog-user-token: $FOG_USER_TOKEN" \ @@ -26,8 +21,13 @@ if [ "$confirmation" == "o" ]; then #Envoi du WOL à chaque MAC echo "Révéil des machines" for MAC in $MACS; do - #echo "💡 Envoi WOL à $MAC" - wakeonlan "$MAC" + #Broadcast Global + #echo "💡 Envoi WOL à $MAC via 255.255.255.255" + wakeonlan -i 255.255.255.255 "$MAC" + + #Broadcast Local + #echo "💡 Envoi WOL à $MAC via 192.168.106.255" + wakeonlan -i "$LOCAL_BROADCAST_IP" "$MAC" done @@ -42,7 +42,7 @@ if [ "$confirmation" == "o" ]; then EOF ) - # Création de la tâche + #Création de la tâche via l'API de FOG echo "Création de la tâche pour le groupe ${GROUP_ID}" curl -s -H "fog-api-token: ${FOG_API_TOKEN}" -H "fog-user-token: ${FOG_USER_TOKEN}" \ -H "Content-Type: application/json" \