Skip to content

Instantly share code, notes, and snippets.

@tazjel
Forked from kirb/storeup.sh
Created January 31, 2013 21:22
Show Gist options
  • Save tazjel/4686570 to your computer and use it in GitHub Desktop.
Save tazjel/4686570 to your computer and use it in GitHub Desktop.
#!/bin/bash
isup=0
check=0
store=au # change this to your country code
player=play
sound=/System/Library/Sounds/Tink.aiff
if [[ "$(which afplay)" != "" ]]; then
player=afplay
fi
if [[ -f "/System/Library/Audio/UISounds/Tink.caf" ]]; then
sound=/System/Library/Audio/UISounds/Tink.caf
fi
while [[ "$isup" != "1" ]]; do
check=$((check + 1))
(curl -I "http://store.apple.com/$store" | grep -E "^HTTP/1.1 503") > /dev/null 2>/dev/null
if [[ $? != 0 ]]; then
echo "$(date): STORE IS UP - checked $check times"
isup=1
"$player" "$sound"
"$player" "$sound"
else
echo -n .
sleep 90
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment