Skip to content

Instantly share code, notes, and snippets.

@ddierickx
Created December 24, 2015 11:08
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 ddierickx/646434a9603ca9c8c06e to your computer and use it in GitHub Desktop.
Save ddierickx/646434a9603ca9c8c06e to your computer and use it in GitHub Desktop.
#!/bin/bash
GPIO_PORT=13
HOSTS=(A B C)
for host in ${HOSTS[@]}; do
ping "$host" -c1 > /dev/null
if [ "$?" = "0" ]; then
gpio mode $GPIO_PORT output && gpio write $GPIO_PORT 1
exit 0
fi
done
gpio mode $GPIO_PORT output && gpio write $GPIO_PORT 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment