Skip to content

Instantly share code, notes, and snippets.

@oscahie
Last active August 29, 2015 14:06
Show Gist options
  • Save oscahie/fbccc88203f335b47e14 to your computer and use it in GitHub Desktop.
Save oscahie/fbccc88203f335b47e14 to your computer and use it in GitHub Desktop.
A super quick & dirty shell script to monitor the status of the Apple Online Store for any country
#!/bin/bash
# A super quick & dirty shell script to monitor the status of the Apple Online Store for any country.
# It does so by checking the HTTP status code returned upon requesting the main page (503 when it's down).
# When the store comes back online you get alerted through the speaker, in case you were sleeping :)
# You could probably easily change that to send an email or whatever instead.
APPLE_STORE_URL=http://store.apple.com/nl/buy-iphone/iphone6
STATUS=503
while [ $STATUS != 200 ]
do
echo "`date` Checking..."
STATUS=`curl -o /dev/null --silent --head --write-out '%{http_code}\n' $APPLE_STORE_URL`
if [ $STATUS == 503 ]; then
echo "Nope, still closed!"
sleep 10;
else
echo "Status: $STATUS"
fi
done
echo "Apple Store is OPEN!"
# it's late and I'm probably sleeping... wake myself up!
say Hey Wake Up, Hey Wake Up, Hey Wake Up, Hey Wake Up, Hey Wake Up,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment