-
-
Save Christopher-A/2033205 to your computer and use it in GitHub Desktop.
Self-contained WWDC Status Checker With Prowl For Cron Jobs
This file contains hidden or 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 | |
api_key="your Prowl API key goes here" | |
cd ~ | |
testSiteForChanges () { | |
ls "old_page.html" 1>/dev/null 2>/dev/null | |
if [ $? -eq "1" ] ; then | |
curl $1 --silent -o old_page.html | |
fi | |
curl $1 --silent -o new_page.html | |
diff old_page.html new_page.html 1>/dev/null | |
if [ $? -eq "0" ] ; then | |
page_changed=0 | |
else | |
page_changed=1 | |
fi | |
rm new_page.html | |
return $page_changed | |
} | |
#testSiteForChanges "http://www.cnn.com" | |
testSiteForChanges "https://developer.apple.com/wwdc/" | |
if [ $? -eq "1" ] ; then | |
url="https://api.prowlapp.com/publicapi/add?apikey=${api_key}" | |
url="${url}&application=WWDC%202012" | |
url="${url}&event=Registration%20Open" | |
url="${url}&description=It%20is%20time...%20maybe." | |
url="${url}&priority=2" | |
curl -k -s ${url} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need to add a second check in there against the occasional 404 that pops up.
the 404 code looks like this, note there is a newline at the end that the gist trims