Guzmán Castanedo Villalba 3 年之前
父節點
當前提交
b315503dfc
共有 1 個文件被更改,包括 25 次插入0 次删除
  1. 25 0
      start-wol.sh

+ 25 - 0
start-wol.sh

@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Datos
+MAC="12:34:56:78:9a:bc"
+HOST="192.168.1.11"
+PORT="22"
+WAIT="5"
+MAX_TRIES="12"
+
+# Wake On LAN
+echo -en "Arrancando con WOL (${HOST}):\n"
+wol -p ${PORT} ${MAC}
+# Arrancado?
+echo -en "Comprobando si ha arrancado..."
+for i in $(seq 1 ${MAX_TRIES}); do
+   sleep ${WAIT}
+   aux=$(ping -c 1 ${HOST} 2>&1)
+   if [ $? -eq 0 ]; then
+      echo -en " ${HOST} HA ARRANCADO.\n"
+      break
+   fi
+   if [ $i -eq ${MAX_TRIES} ]; then
+      echo -en " ${HOST} NO HA ARRANCADO.\n"
+   fi
+done