1 #!/bin/sh 2 #根据进程名杀死进程 3 if [ $# -lt 1 ] 4 then 5 echo "缺少参数:procedure_name" 6 exit 1 7 fi 8 9 PROCESS=`ps -ef|grep $1|grep -v grep|grep -v PPID|awk '{ print $2}'` 10 for i in $PROCESS 11 do 12 echo "Kill the $1 process [ $i ]" 13 kill -9 $i 14 done
引自:http://www.fengdingbo.com/shell-stop-procedure.html