-
-
Save bobspryn/5230835 to your computer and use it in GitHub Desktop.
Updated version makes sure the response code is 200. Also saves any possible false alarms to a file so we can evaluate how to fix those.
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 | |
response=$(curl $1 --write-out %{http_code} --silent -o new_page.html) | |
diff old_page.html new_page.html 1>/dev/null | |
if [ $? -eq "0" ] ; then | |
page_changed=0 | |
else | |
if [ $response -eq "200" ] ; then | |
page_changed=1 | |
cp new_page.html false_alarm.html | |
else | |
page_changed=0 | |
fi | |
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