You have me up later than I have been since Jude was born waiting to order the new iPhone 4S. Of course, the site is still being updated and it’s already 12:37PST. Since I’m sick of clicking refresh (yes, I have been doing it for 45 minutes now) I’ve decided to crontab the job. This is pretty simple, curl the site, compare it to the site I curl’ed one minute ago, if it’s any different Bruce screams “BUY iPHONE”!! Now I can take a nap until something finally changes…
1) Open terminal.
2) Type vi ~/checkIphone.sh
3) This is the vi editor, type “i” to go into insert mode.
4) copy and paste the following:
/usr/bin/curl “http://store.apple.com/us/browse/home/shop_iphone/family/iphone” > ~/tmpApple.txt
/usr/bin/diff ~/tmpApple.txt.old ~/tmpApple.txt > ~/tmpdiffApple.txt
dlines=`/usr/bin/more ~/tmpdiffApple.txt | wc -l`
/usr/bin/curl “http://store.apple.com/us/browse/home/shop_iphone/family/iphone” > ~/tmpApple.txt.old
if [ $dlines -gt 10 ]
then say “buy iphone”
5) type “:wq” to save the text.
6) You should be back in the terminal now. Type “crontab -e” to go into the editor.
7) On the first line, type
* * * * * /Users/rasmussj/checkIphone.sh;
And use “:wq” to save and quit.
8) (I put a “)” here and got a sunglass emoticon, ugh) Wait for Stephen Hawking to tell you “BUY IPHONE”
9) Get excited to see a valid page
10) Go absolutely mental that the #$%@ site can’t successfully take your order after 5 #$%@ing tries!!!!