Saturday, May 8, 2010

Use of HTTPing to check web and app

# ------------------------------------------------------------
# Auto restart blackboard services if http is not responding
# ------------------------------------------------------------

hostname=`uname -n`
COUNT=`httping -c 1 -g ${hostname}| grep -v grep | grep '100.00% failed' | wc -l`
if [ $COUNT = 1 ]; then
echo "Apache is not responding"
/usr/local/blackboard/tools/admin/ServiceController.sh services.restart
fi


#------------------------------------------
# Checks whether tomcat is running
#------------------------------------------

COUNT=`httping -s -c 1 -g http://${hostname}/webapps/login/ | grep -v grep | grep 'Service Temporarily Unavailable' | wc -l`
if [ $COUNT = 1 ]; then
echo "Tomcat is not responding"
/usr/local/blackboard/tools/admin/ServiceController.sh services.appserver.restart
fi

COUNT=`httping -s -c 1 -g http://${hostname}/webapps/login/ | grep -v grep | grep '100.00% failed' | wc -l`
if [ $COUNT = 1 ]; then
echo "Tomcat is not responding"
/usr/local/blackboard/tools/admin/ServiceController.sh services.appserver.restart
fi

1 comment:

  1. Use TNSPING to check database connectivity between the application server and the database server:

    count=`/opt/oracle/client10g2/bin/tnsping ${SID} | grep OK | grep -v grep | wc -l`
    if [ $count = 0 ]; then
    echo "H E L P....!!!!!"
    fi

    ReplyDelete