This script is useful to frequently monitor db and apps listener status running on single node.
Run this script in crontab to frequently monitor db&app listener status.
#!/bin/bash
rm DB.log
rm AP.log
ps -ef|grep tns|grep -v APPS_DEV|grep -v grep >DB.log ###########APPS_<DBNAME>########
ps -ef|grep tns|grep APPS_DEV|grep -v grep >AP.log ###########APPS_<DBNAME>########
if [ -s DB.log ]
then
if [ -s AP.log ]
then
echo -e “\e[1;32m DB LISTENER UP : `date` | \e[1;32m APP LISTENER UP :`date` \e[0m” >>lis.log
else
echo -e “\e[1;32m DB LISTENER : `date` | \e[1;31m APP LISTENER DOWN :`date` \e[0m” >>lis.log
fi
elif [ -s AP.log ]
then
echo -e “\e[1;31m DB LISTENER DOWN: `date` | \e[1;32m APP LISTENER UP :`date` \e[0m” >>lis.log
else
echo -e “\e[1;31m DB LISTENER DOWN: `date` | \e[1;31m APP LISTENER DOWN :`date` \e[0m” >>lis.log
fi