#!/bin/bash
echo " Web Starter Script...."
update-rc.d -f apache2 remove
killall -w httpd
rm /var/apache2/logs/error_log
apachectl start
sleep 5
while true
do 
	if [ -f "/var/apache2/logs/error_log" ]; then
		if [ "$(grep -c 'AH01243' /var/apache2/logs/error_log)" -ge 1 ]; then
			killall -w httpd
			echo Restarting Apache....
			rm /var/apache2/logs/error_log
			apachectl restart
			sleep 5
		else
		    exit
		fi
	fi
	sleep 1
done
