shell脚本关闭tomcat


使用shell脚本快速关闭tomcat,就是获取tomcat进程后,一起kill掉:

#!/bin/sh
#kill tomcat pid
name=tomcat-emall
pidlist=`ps -ef | grep $name | grep -v "grep" | awk '{print $2}'`
function stop(){
if [ "$pidlist" == "" ]
then
echo "----$name 已经关闭----"
exit 0
else
echo "----$name 进程号 :$pidlist"
kill -9 $pidlist
echo "KILL $pidlist:"
fi
}

stop
pidlist2=`ps -ef | grep $name | grep -v "grep" | awk '{print $2}'`
if [ "$pidlist2" == "" ]
then
echo "----关闭$name成功----"
else
echo "----关闭$name失败----"
fi

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM