Skip to content

Instantly share code, notes, and snippets.

@jcderr
Last active January 26, 2016 18:43
Show Gist options
  • Save jcderr/6f296d8ad8a0b13af4de to your computer and use it in GitHub Desktop.
Save jcderr/6f296d8ad8a0b13af4de to your computer and use it in GitHub Desktop.
wait until server/url responds with 200
#!/bin/bash
URL=$1
CODE="200"
[[ -n "$URL" ]] || { echo "Please specify a URL to watch"; exit 1; }
[[ -n "$2" ]] && CODE=$2
while true; do
STATUS=$(curl -o /dev/null --insecure --silent --head --write-out '%{http_code}' ${URL})
[[ "${STATUS}" == "${CODE}" ]] && { echo "."; break; }
echo -n "."
sleep 5
done
echo "Good!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment