|
@@ -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
|