Skip to content

Instantly share code, notes, and snippets.

@bwhiteley
Last active December 16, 2015 14:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwhiteley/5451948 to your computer and use it in GitHub Desktop.
Save bwhiteley/5451948 to your computer and use it in GitHub Desktop.
My WWDC ticket alert system. Run in screen on linux.
#!/bin/bash
theSite="https://developer.apple.com/wwdc/"
foo=$(curl $theSite)
echo $foo
oldFile=$(date +"%Y-%m-%d-%H_%M_%S").start
echo "$foo" > $oldFile
while true; do
let slp=$RANDOM%20+10
echo "sleeping $slp $theSite"
sleep $slp
bar=$(curl --connect-timeout 45 --max-time 60 $theSite)
if [ "x$foo" != "x$bar" ]; then
mail -r <from_email> -s "WWDC 2013 !" <my_email> <wife_email> <my_phone>@txt.att.net <wife_phone>@tmomail.net << EOS
Quick, go to $theSite
EOS
newFile=$(date +"%Y-%m-%d-%H_%M_%S").txt
echo "$bar" > $newFile
diff -u $oldFile $newFile | mail -r <from_email> -s "WWDC site diff" <my_email>
oldFile=$newFile
foo=$bar
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment