Last active
December 15, 2015 05:19
-
-
Save lemonkey/5208512 to your computer and use it in GitHub Desktop.
Cron job script to automatically notify you via email and telephone (using Twilio) if Apple's WWDC website changes. Originally written for Bash environments that have Sendmail installed.
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/sh | |
CAN_COMPARE=0; | |
EMAIL="<list of email addresses separated with a space"; | |
# If index.html exists, rename to index.html.old. | |
if [ -f index.html ]; | |
then | |
CAN_COMPARE=1; | |
mv index.html index.html.old | |
fi | |
# Get latest wwdc HTML. | |
/usr/local/bin/wget --no-check-certificate http://developer.apple.com/wwdc | |
# Abort if 404, etc. | |
if [ ! -f index.html ]; | |
then | |
echo "Error checking WWDC. Aborting..."; | |
exit; | |
fi | |
# Compare index.html to index.html.old. If different, send out alert! | |
if [ $CAN_COMPARE -eq 1 ]; | |
then | |
if /usr/bin/diff index.html index.html.old >/dev/null ; then | |
echo "No change"; | |
else | |
echo "WWDC site has changed!"; | |
# Send out HTML email. | |
( | |
echo "Subject: WWDC site has changed!"; | |
echo "MIME-Version: 1.0"; | |
echo "Content-Type: text/html"; | |
echo "Content-Disposition: inline"; | |
cat index.html; | |
) | /usr/sbin/sendmail $EMAIL | |
# Call cell using twilio.com. | |
/usr/local/bin/curl -X POST https://api.twilio.com/<your Twilio key info>/Calls.json \ | |
-u <your Twilio user ID> \ | |
-d "From=+<your Twilio account phone number>" \ | |
-d "To=+<phone number you want to call>" \ | |
-d 'Url=http%3A%2F%2Ftwimlets.com%2Fecho%3FTwiml%3D%253CResponse%253E%253CSay%253E<URL encoded message>%2521%253C%252FSay%253E%253C%252FResponse%253E'; | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment