cti-tserver-stop.sh 676 Bytes
#!/bin/bash

cnt=`ps -ef |grep "cti-tserver" |grep -v "grep" | grep -v "cti-tserver.log" | grep -v "cti-tserver-stop.sh"| grep -v "cti-tserver-restart.log" | wc -l`

if [ ${cnt} -ge 1 ] ; then
	/etc/init.d/cti-tserver stop
	res=`ps -ef |grep "cti-tserver" |grep -v "grep" | grep -v "cti-tserver-restart.log" | grep -v "cti-tserver.log" | grep -v "cti-tserver-stop.sh" | wc -l`
	if [ ${res} -lt ${cnt} ] ; then
		echo "[INFO]:cti-tserver stop success." >> /var/log/cti-tserver-restart.log
	else
		echo "[ERROR]:cti-tserver stop failed." >> /var/log/cti-tserver-restart.log
		pid=`ps -aux | grep "cti-tserver" | grep -v grep | awk '{print $2}'`
		/usr/bin/kill -9 ${pid}
	fi
fi