Skip to content

Instantly share code, notes, and snippets.

@sturadnidge
Last active July 23, 2017 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sturadnidge/e2d9619377739bf55fc8d2e411b49133 to your computer and use it in GitHub Desktop.
Save sturadnidge/e2d9619377739bf55fc8d2e411b49133 to your computer and use it in GitHub Desktop.
Quick and dirty HTTP monitor
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Usage: $0 {host.fqdn}"
echo "runs curl against a host until it doesn't"
exit 1
fi
HOST=$1
while :
do
RESULT=`curl -I -s ${HOST} | head -n 1`
if [[ ${RESULT} != *"200"* ]];then
echo "$(date "+%Y-%m-%d %H:%M:%S") ${RESULT}"
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment