sp_pid=`ps -ef | grep sp-tomcat | grep -v grep | awk '{print $2}'`
if [ -z "$sp_pid" ];
then
echo "[ not find sp-tomcat pid ]"
else
echo "find result: $sp_pid "
kill -9 $sp_pid
注意:使用时,需要把第一行的 sp-tomcat 替换换成你希望杀的进程
转自:https://www.cnblogs.com/zeng1994/p/13a2c5a28e55dd3abc2c75a4fb80371a.html