#!/bin/bash pass="1" function watch { parseLog=`cat /etc/httpd/logs/error_log |tail -n 15 | grep "Doing graceful restart"` if [ -z "$parseLog" ] then echo "Check #$pass" echo "No graceful restarts yet.." else echo "Check #$pass" echo "Graceful restart detected!" ps aux > /root/restartWatch-$(/bin/date +%H:%M::%m-%d-%Y) fi } count="0" while [ $count -lt "10" ]; do watch pass=`expr $pass + 1` echo "sleeping one second.." sleep 1s done