Skip to content

Instantly share code, notes, and snippets.

@knmkr
Created October 4, 2015 06:18
Show Gist options
  • Select an option

  • Save knmkr/6f969eb40b40ac00470d to your computer and use it in GitHub Desktop.

Select an option

Save knmkr/6f969eb40b40ac00470d to your computer and use it in GitHub Desktop.
Healthchek URL with auth
#!/usr/bin/env bash
set -e
AUTH_USER=user
AUTH_PASS=pass
URL=http://www.example.com
OUT=/tmp/log/healthcheck/example.com
STATUS=$(curl -L --anyauth --user ${AUTH_USER}:${AUTH_PASS} ${URL} -o ${OUT} -s -w '%{http_code}\n')
if [[ "${STATUS}" != 200 ]]; then
echo Not 200 on ${URL}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment