#!/bin/bash
if curl -s --head 'https://your-domain.com/' | grep "200 OK" > /dev/null
then
echo "Apache server is up!" > /dev/null
else
echo "Apache server is down!"
/etc/init.d/apache2 restart
fi
web