#!/usr/bin/ksh
cd `dirname $0`
. ./common.lib
typeset -i errcnt=0
# sa
typeset said=$(cat ${cfg_pro} | grep "^SA_NODEID=" | sed -n "s#SA_NODEID=\(.*\)#\1#p" | sed "s#;# #g")
for nodeid in $said
do
# check the float IP has been bound here or not
#float_ip=`./querydb.sh "select * from ProductName_T_NODE where NODETYPE = 10 and NODEID = ${nodeid}" IPADDRESS | sed "s/\s//g"`
float_ip=`cat ${cfg_pro} | grep -i "^SA_LISTEN_IP=" | sed -n "s#SA_LISTEN_IP=\(.*\)#\1#p" | sed "s#\s##g"`
typeset -i float_ip_cnt=`/sbin/ifconfig | grep "${float_ip}" | wc -l`
if [ $float_ip_cnt -eq 0 ]
then
#echo "sa need not start in this locale machine, because \"${float_ip}\" is not bound here."
continue
fi
typeset -i count_sa=`ps -ef | grep ${LOGNAME} | grep "${ProductName_path}/bin/sa -t 10 -n ${nodeid}" | grep -v "grep" | wc -l`
if [ $count_sa -gt 0 ]
then
pid=`ps -ef | grep ${LOGNAME} | grep "${ProductName_path}/bin/sa -t 10 -n" | grep -v "grep" | awk -F' ' '{print $2}' | sed -n '1p'`
echo "sa(NODE ID: ${nodeid}, PID: ${pid}) is running."
else
echo "sa(NODE ID: ${nodeid}) is stopped."
((errcnt=errcnt+1))
fi
done
# so
typeset soid=$(cat ${cfg_pro} | grep "^SO_NODEID=" | sed -n "s#SO_NODEID=\(.*\)#\1#p" | sed "s#;# #g")
for nodeid in $soid
do
typeset -i count_so=`ps -ef | grep ${LOGNAME} | grep "${JAVA_HOME}/bin/java.*com.so.nodeID=${nodeid}.*com.so.nodeType=20.*" | grep "${HOME}/ProductName" | grep -v "grep" | wc -l`
if [ $count_so -gt 0 ]
then
pid=`ps -ef | grep ${LOGNAME} | grep "${JAVA_HOME}/bin/java.*com.so.nodeID=${nodeid}.*com.so.nodeType=20.*" | grep "${HOME}/ProductName" | grep -v "grep" | awk -F' ' '{print $2}' | sed -n '1p'`
echo "so(NODE ID: ${nodeid}, PID: ${pid}) is running."
else
echo "so(NODE ID: ${nodeid}) is stopped."
((errcnt=errcnt+1))
fi
done
# dr
typeset drid=$(cat ${cfg_pro} | grep "^DR_NODEID=" | sed -n "s#DR_NODEID=\(.*\)#\1#p" | sed "s#;# #g")
for nodeid in $drid
do
typeset -i count_dr=`ps -ef | grep ${LOGNAME} | grep "${ProductName_path}/bin/sa -t 40 -n ${nodeid}" | grep -v "grep" | wc -l`
if [ $count_dr -gt 0 ]
then
pid=`ps -ef | grep ${LOGNAME} | grep "${ProductName_path}/bin/sa -t 40 -n ${nodeid}" | grep -v "grep" | awk -F' ' '{print $2}' | sed -n '1p'`
echo "dr(NODE ID: ${nodeid}, PID: ${pid}) is running."
else
echo "dr(NODE ID: ${nodeid}) is stopped."
((errcnt=errcnt+1))
fi
done
# result
if [ $errcnt -ne 0 ]
then
echo "ProductName is stopped."
else
echo "ProductName is running."
fi
return $errcnt