Skip to content

Instantly share code, notes, and snippets.

@gcmurphy
Created August 29, 2014 03:14
Show Gist options
  • Save gcmurphy/c650d8bfda9903a71b5e to your computer and use it in GitHub Desktop.
Save gcmurphy/c650d8bfda9903a71b5e to your computer and use it in GitHub Desktop.
simple pingdom replacement
#!/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