Created
August 29, 2014 03:14
-
-
Save gcmurphy/c650d8bfda9903a71b5e to your computer and use it in GitHub Desktop.
simple pingdom replacement
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/bash | |
# Check if your site is still up and send you a direct tweet if it isn't | |
# | |
# [dependencies] | |
# libwww-perl | |
# ruby-gem -> t | |
# | |
# [setup] | |
# mkdir ~/twitter_alerts | |
# t authorize | |
# crontab -e | |
# */10 * * * $HOME/bin/tw.sh | |
WS="<your website>" | |
TW="<your twitter handle>" | |
if [ "$(HEAD $WS | head -n 1 | awk '{ print $1 }')" != "200" ]; then | |
alert_sent="$HOME/.twitter_alerts/$(date +%Y%m%d_%H)" | |
if [ ! -e "$alert_sent" ]; then | |
t dm $TW "$WS service is down" | |
touch $alert_sent | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment