cti-tserver-start.sh 1.35 KB
#/bin/bash

stopcnt=`ps -ef |grep "cti-tserver-stop.sh" | grep -v "grep" | wc -l`
if [ ${stopcnt} -ge 1 ] ; then
	stoppid=`ps -ef |grep "cti-tserver-stop.sh" | grep -v "grep" | awk '{print $2}'`
	/bin/kill -9 ${stoppid}
	echo "[WARN]:cti-tserver kill cti-tserver-stop.sh success." >> /var/log/cti-tserver-restart.log
fi

sleep 10
tservercnt=`ps -ef |grep "cti-tserver" |grep -v "grep" | grep -v "cti-tserver.log" | grep -v "cti-tserver-restart.log" |grep -v "cti-tserver-start.sh" | wc -l`
if [ ${tservercnt} -ge 1 ] ; then
	tserverpid=`ps -ef |grep "cti-tserver" |grep -v "grep" | grep -v "cti-tserver.log" | grep -v "cti-tserver-restart.log" |grep -v "cti-tserver-start.sh" | awk '{print $2}'`
	/bin/kill -9 ${tserverpid}
	echo "[WARN]:cti-tserver kill cti-tserver success." >> /var/log/cti-tserver-restart.log
fi

sleep 10
tservercnt=`ps -ef |grep "cti-tserver" |grep -v "grep" | grep -v "cti-tserver.log" | grep -v "cti-tserver-restart.log" |grep -v "cti-tserver-start.sh" | wc -l`
/etc/init.d/cti-tserver start
res=`ps -ef |grep "cti-tserver" |grep -v "grep" | grep -v "cti-tserver.log" | grep -v "cti-tserver-restart.log" |grep -v "cti-tserver-start.sh" | wc -l`
if [ ${res} -gt ${tservercnt} ] ; then
	echo "[INFO]:cti-tserver start success." >> /var/log/cti-tserver-restart.log
else
        echo "[ERROR]:cti-tserver start failed." >> /var/log/cti-tserver-restart.log
fi