# Check CM Backlog
0,10,20,30,40,50 * * * * (/sbin/mount|grep -v NFS|grep -q /p760/app) && /home/oracle/scripts/cmbacklog.sh p760 1>/home/oracle/scripts/cmbacklog.log 2>/home/oracle/scripts/cmbacklog.err
#!/bin/ksh
if [ $# -ne 1 ]; then # number of parameters should be one
echo "cmbacklog.sh <instance name>" # tell user the correct format
exit 1 # exit with status 1
else
ins_nm=$1 # instance name $1 is stored in ins_nm variable
. /usr/local/bin/db_$ins_nm # set the environment
mid="DL-GIDOperationsEBSProductionDBA@corp.com,DL-GIDDBA@corp.com" #mid parameter stores to whom mail will be sent
cd /home/oracle/scripts
count=`sqlplus -s / @cmbacklog.sql |grep sum|awk '{print $6}'`
if [ $count -gt 50 ]
then
echo First Count $count
sleep 300 # check again after 5 minutes that is count decreasing
count2=`sqlplus -s / @cmbacklog.sql |grep sum|awk '{print $6}'`
echo Second Count $count2
if [ $count2 -gt $count ] # check if count after 5 minute has increased
then
mailx -Um -s " High CM Backlog in $ins_nm: Pending Count ($count;$count2) " $mid < cmbacklog.lst
fi
else echo "Pendig count $count"
fi
fi