-
-
Save jcderr/6f296d8ad8a0b13af4de to your computer and use it in GitHub Desktop.
wait until server/url responds with 200
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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