GNU/Linux BASH website probe using CURL
Small script I used to probe a website. Script should returns a message only when the state changes.
#!/bin/bash
function funcProbe {
curl ${1} -k -I -s | grep "HTTP/1.1 200 OK" > /dev/null
if [ $? -ne 0 ]; then
if [ ! -f /tmp/prb-${2}-DOWN ]; then
echo "[S2:Probe-${2}] Service DOWN Detected!"
fi
touch /tmp/prb-${2}-DOWN
rm -f /tmp/prb-${2}-UP
else
if [ ! -f /tmp/prb-${2}-UP ]; then
echo "[S2:Probe-${2}] Service UP Detected!"
fi
touch /tmp/prb-${2}-UP
rm -f /tmp/prb-${2}-DOWN
fi
}
funcProbe https://tech.ne7.nl/ Repository