Last active
July 23, 2017 02:04
-
-
Save sturadnidge/e2d9619377739bf55fc8d2e411b49133 to your computer and use it in GitHub Desktop.
Quick and dirty HTTP monitor
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 | |
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