Created
February 6, 2019 08:43
-
-
Save gbitdev/b63c9afc170ee0ce37b82c521dc711eb to your computer and use it in GitHub Desktop.
cURL health_check
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
| #!/usr/bin/env bash | |
| set -e | |
| URL=$1 | |
| : ${URL:='127.0.0.1'} | |
| status=$(curl -I --insecure --silent --output /dev/null --write-out %{http_code} $URL) | |
| if [[ "$status" -eq 200 ]] ; then | |
| echo 'OK' | |
| exit 0 | |
| else | |
| echo 'ERROR' | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment