Skip to content

Instantly share code, notes, and snippets.

@rcw3
Created March 11, 2012 18:50
Show Gist options
  • Save rcw3/2017653 to your computer and use it in GitHub Desktop.
Save rcw3/2017653 to your computer and use it in GitHub Desktop.
Crude WWDC announcement detector
#!/bin/bash
testSiteForChanges ()
{
ls "old_page.html" 1>/dev/null 2>/dev/null
if [ $? -eq "1" ] ; then
wget -q -O old_page.html $1
fi
wget -q -O new_page.html $1
diff old_page.html new_page.html 1>/dev/null
if [ $? -eq "0" ] ; then
#echo "SAME!"
CHANGES=0
else
#echo "CURRENT WEB PAGE IS DIFFERENT THAN ORIGINAL!!"
CHANGES=1
fi
rm new_page.html
return $CHANGES
}
#testSiteForChanges "http://www.cnn.com"
testSiteForChanges "https://developer.apple.com/wwdc/"
if [ $? -eq "1" ] ; then
echo "WWDC MAY HAVE BEEN ANNOUNCED!!" > wwdc_email.txt
mail -s "WWDC" you@some_address.com < wwdc_email.txt
rm wwdc_email.txt
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment