您的位置:首页 > 运维架构 > Shell

转:shell杀死指定名称的进程

2016-05-17 20:12 549 查看
#!/bin/sh
#根据进程名杀死进程
if [ $# -lt 1 ]
then
echo "缺少参数:procedure_name"
exit 1
fi

PROCESS=`ps -ef|grep $1|grep -v grep|grep -v PPID|awk '{ print $2}'`
for i in $PROCESS
do
echo "Kill the $1 process [ $i ]"
kill -9 $i
done


引自:http://www.fengdingbo.com/shell-stop-procedure.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: