Skip to content

Instantly share code, notes, and snippets.

@miri64
Created October 1, 2012 13:00
Show Gist options
  • Save miri64/3811672 to your computer and use it in GitHub Desktop.
Save miri64/3811672 to your computer and use it in GitHub Desktop.
Wake script for spline workstations
#!/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