Skip to content

Instantly share code, notes, and snippets.

@gbitdev
Created February 6, 2019 08:43
Show Gist options
  • Select an option

  • Save gbitdev/b63c9afc170ee0ce37b82c521dc711eb to your computer and use it in GitHub Desktop.

Select an option

Save gbitdev/b63c9afc170ee0ce37b82c521dc711eb to your computer and use it in GitHub Desktop.
cURL health_check
#!/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