Skip to content

Instantly share code, notes, and snippets.

@caius
Created July 27, 2010 12:45
Show Gist options
  • Select an option

  • Save caius/492170 to your computer and use it in GitHub Desktop.

Select an option

Save caius/492170 to your computer and use it in GitHub Desktop.
#!/bin/zsh
# Borrowed from http://files.iconfactory.net/craig/twitter/checkdevsite.txt
# Thanks @Chockenberry!
URL="http://store.apple.com/uk"
while :; do
curl -s $URL | grep -i "we'll be back soon" > /dev/null
if [[ $? == 0 ]]; then
echo "$(date): down"
else
osascript -e 'tell app "iTunes" to pause'
sleep 1
say "THE STORE IS UP"
open $URL
echo "up"
prowlnotify -p emergency "Apple store is up"
osascript -e 'tell app "iTunes" to play'
break
fi
# Suggestion from @peterc
sleep $(($RANDOM % 30 + 10))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment