We have a requirement to bounce one application every Sunday and then check whether it came back fine or not after bouncing, along with that we need to avoid bouncing it if its in maintanance.
I have to make this cron job where if one of the proccess ( called PROV ) is less than 1 , then its probably down for maintanance and I need to send the page to team telling abt it.
Secondly, if the process is equal to 49, then i need to restart the application.
Thirdly , once I bounce the application( as in step 2) then it shud check whether the number of processes is equal to 49 and if not then notify the team.
I need one single script to do all this.
Here is the sample script:
-----------------------------------------------------------
prov=`ps -ef|grep -v grep |grep PROV |grep sldprod|grep -v PROVUPD|grep -v PROVFTTP|wc -l`
if [ $prov -lt 1 ]
then
mailx -s "Prov is down so not retstarting it" ab@ab.com
/usr/localcw/bin/beep AB “servername: PROVs not running currently so not restarting it”
fi
if [ $prov -eq 49 ]
then
tmshutdown –w 30 –s PROV 2>&1 > /tmp/provbounce.log
tmshutdown –w 30 –s PROVMGR 2>&1 >> /tmp/provbounce.log
sleep 10
tmboot –s PROVMGR 2>&1 >> /tmp/provbounce.log
tmboot –s PROV 2>&1 >> /tmp/provbounce.log
fi
sleep 90
if [ $prov -lt 49 -a $prov -gt 1 ]
then
mailx -s "Not all PROV processes started after bounce" ab@ab.com < /tmp/provbounce.log
/usr/localcw/bin/beep AB “servername: Not all PROV processes started after bounce”
fi
I have to make this cron job where if one of the proccess ( called PROV ) is less than 1 , then its probably down for maintanance and I need to send the page to team telling abt it.
Secondly, if the process is equal to 49, then i need to restart the application.
Thirdly , once I bounce the application( as in step 2) then it shud check whether the number of processes is equal to 49 and if not then notify the team.
I need one single script to do all this.
Here is the sample script:
-----------------------------------------------------------
prov=`ps -ef|grep -v grep |grep PROV |grep sldprod|grep -v PROVUPD|grep -v PROVFTTP|wc -l`
if [ $prov -lt 1 ]
then
mailx -s "Prov is down so not retstarting it" ab@ab.com
/usr/localcw/bin/beep AB “servername: PROVs not running currently so not restarting it”
fi
if [ $prov -eq 49 ]
then
tmshutdown –w 30 –s PROV 2>&1 > /tmp/provbounce.log
tmshutdown –w 30 –s PROVMGR 2>&1 >> /tmp/provbounce.log
sleep 10
tmboot –s PROVMGR 2>&1 >> /tmp/provbounce.log
tmboot –s PROV 2>&1 >> /tmp/provbounce.log
fi
sleep 90
if [ $prov -lt 49 -a $prov -gt 1 ]
then
mailx -s "Not all PROV processes started after bounce" ab@ab.com < /tmp/provbounce.log
/usr/localcw/bin/beep AB “servername: Not all PROV processes started after bounce”
fi