Created
October 31, 2012 15:56
-
-
Save focustrate/3987869 to your computer and use it in GitHub Desktop.
Datagram static page update check during Hurricane Sandy
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 | |
# | |
# 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" [email protected] | |
fi | |
mv $new_file $init_file; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment