Created
September 8, 2016 21:31
-
-
Save flxai/cae8c90ae3a1e8cba12b0e82e94eeb8d to your computer and use it in GitHub Desktop.
flipdot Wake On LAN
This file contains hidden or 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 | |
# 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