Skip to content

Check the status of the online Apple Store

We're only hours away from today's Apple event. So millions of people are now preparing themselves, practicing their Command-R keystrokes, so they can reload the online Apple Store page as quickly as possible.

Me? I'm letting my computer do the work. I wrote a shell script (which uses the handy terminal-notifier Ruby gem) and cron to keep an eye on the store, and notify me when it's back online.

Caution: I am not a programmer by trade. I know just enough about shell scripts to be dangerous. Typically this is only to myself, but as I'm publishing this one, it's potentially dangerous (or at least inefficient) to others. Proceed at your own risk.

My script checks the store about every three seconds, and does absolutely nothing if the store is still down. If it's up, it uses the aforementioned terminal-notifier app to send an OS X notification:


I click the notification, and bingo, I'm in the store.

The script also checks to see if it has previously noticed that the store is up—if so, it bails with a message letting me know, so hopefully I remember to turn off the cron task:

Without further ado—because you've only got a couple of hours to get this working—here's my script.

Note: The -contentImage and -appIcon bits are optional. The -contentImage shows at the right of the notification, and the -appIcon appears to the left. I've used a shot of an Apple retail storefront and an Apple logo, respectively. If you don't want images, just remove those two lines from each use of the terminal-notifier command.

I have this script set up as a cron task to run every minute; the script takes about 45 to 50 seconds to run each time, so there's about 10 to 15 seconds of downtime before the task refires.

I leave the cron task disabled until the keynote is almost over, then I start it up and go back to work, confident (well, mostly) that my script will alert me when I can get into the store.

To implement this script, you'll need to create it, save it, and make it executable (chmod 755 script_name). You'll also need to install the terminal-notifier script; I used the Ruby install, as it's a simple one liner:

If you use a pre-built binary, make sure you heed the note on the project page about referring to the binary within the bundle; you'll have to update the script to reflect that change.

Finally, to really make use of this, you need to create a cron task or a LaunchAgent. I use cron because I'm old school and lazy. But the details of this last step are left to the reader.

Happy shopping!