Skip to content

Instantly share code, notes, and snippets.

@focustrate
Created October 31, 2012 15:56
Show Gist options
  • Save focustrate/3987869 to your computer and use it in GitHub Desktop.
Save focustrate/3987869 to your computer and use it in GitHub Desktop.
Datagram static page update check during Hurricane Sandy
#!/bin/bash
#
# Because of Hurricane Sandy (and us having all of our stuff co-located at Datagram in lower Manhattan)
# we had a major outage. I used this to monitor their website for updates.
# It's running on a local cronjob, every 5 minutes:
# */5 * * * * /Users/me/check_dg
#
# More about the outage:
# http://www.datacenterknowledge.com/archives/2012/10/30/major-flooding-nyc-data-centers/
init_file='/tmp/dg1' #base
new_file='/tmp/dg2' #comparison
# create init file if running for the first time
if [ ! -f $init_file ];
then
touch $init_file;
fi
curl -s http://datagram.com > $new_file
if ! cmp -s "$init_file" "$new_file";
then
diff "$init_file" "$new_file" | mail -s "DG page update" me@mydomain.com
fi
mv $new_file $init_file;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment