Anonymous Anonymous - 2 months ago
183 0

With this bash script you can check if the webserver returns a 500 response code. If so, it will email you.

Bash

Bash script to test if the webserver returns a 500 response code

Embed
RESPONSE=$(curl -o /dev/null --silent --head --write-out '%{http_code}\n' http://www.mydomain.com)

if [[ $RESPONSE == 500 ]]
then
mail -s "Subject" email@address.com <<< "Body text"
fi
Comments