Last active
November 24, 2017 14:14
-
-
Save yhancik/6fd7291e6fb793bcf90bf988b65e8723 to your computer and use it in GitHub Desktop.
Script for a Raspberry Pi, checking if it's online (or more accurately if Google.com is up), says it aloud with PicoTTS
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
case "$(curl -s --max-time 2 -I http://google.com | sed 's/^[^ ]* *\([0-9]\).*/\1/; 1q')" in | |
[23]) pico2wave -w internet.wav "Online!";; | |
5) pico2wave -w internet.wav "Proxy issue.";; | |
*) pico2wave -w internet.wav "Offline or slow?";; | |
esac | |
aplay internet.wav |
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/sh -e | |
# Print & says the IP address | |
_IP=$(hostname -I) || true | |
if [ "$_IP" ]; then | |
printf "My IP address is %s\n" "$_IP" | |
pico2wave -w ip.wav "My IP address is $_IP" | |
aplay ip.wav | |
fi | |
watch -n1 sh /home/pi/online.sh | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment