Skip to content

Instantly share code, notes, and snippets.

@flxai
Created September 8, 2016 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flxai/cae8c90ae3a1e8cba12b0e82e94eeb8d to your computer and use it in GitHub Desktop.
Save flxai/cae8c90ae3a1e8cba12b0e82e94eeb8d to your computer and use it in GitHub Desktop.
flipdot Wake On LAN
#!/bin/bash
# Pings a list of hosts and send a Wake On LAN request on success
wake_mac='e8:9a:8f:fd:e6:ce'
declare -a ping_hosts=(\
192.168.3.36 \ # flipdot display
guest.fd \
drinks-touch.fd \
drinks.fd \
)
ping_count=0
for host in "${ping_hosts[@]}"; do
ping -qc1 -w3 "$host" &> /dev/null && ((ping_count++))
if [[ "$ping_count" -gt 0 ]]; then
wol "$wake_mac"
exit 0
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment