Created
October 1, 2012 13:00
-
-
Save miri64/3811672 to your computer and use it in GitHub Desktop.
Wake script for spline workstations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$#" -ne 1 ]]; then | |
echo "Usage: $0 <host>" 1>&2 | |
exit 1 | |
fi | |
HOST="$1" | |
declare -A HOSTS | |
HOSTS=( | |
["chop"]="xx:xx:xx:xx:xx:xx" | |
["knister"]="xx:xx:xx:xx:xx:xx" | |
["wuff"]="xx:xx:xx:xx:xx:xx" | |
) | |
C=48 | |
wakeonlan "${HOSTS[$HOST]}" && \ | |
while true; do | |
ping -c 1 -W 1 "$HOST" &> /dev/null && break | |
sleep 5 | |
let C=C-1 | |
if [ $C -eq 0 ]; then | |
exit 1; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment