Created
February 9, 2010 15:22
-
-
Save watson/299306 to your computer and use it in GitHub Desktop.
This script polls the Apple Store every 4 seconds to see if it returns a good HTTP status code. When this happens, it uses your computer speakers to say "Hurray. The Apple Store is now open for business" (note: the sound only works on OS X). It works beca
This file contains 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
require 'open-uri' | |
check_every = 4 # seconds | |
url = "http://store.apple.com/us" | |
check_again = true | |
print "Checking #{url}: " | |
while check_again | |
begin | |
sleep check_every | |
open url | |
check_again = false | |
puts "\nStore is back online!" | |
`say Hurray. The Apple Store is now open for business` | |
rescue | |
print "." | |
$stdout.flush | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice one, I wrote a similar script to monitor the iPhone 6 availability but didn't know about this 'say' command, so I printed BELL chars instead :) This is way more cool! Thanks.