Linux 按名称查找某个进程并关闭 |
发表者:admin分类:Shell脚本2016-11-30 13:13:04 阅读[1974] |
Linux 按名称查找某个进程并关闭。
参考一下,水平有限。
! /bin/sh
ID=`ps -ef| grep 'ntpd'|grep -v 'grep'|awk '{print $2}'`
if [ "$ID" = "" ]
then
echo "ID is not running!"
else
for pid in $ID
do
echo " kill ntpd pid:$pid"
fi
转载请标明出处【Linux 按名称查找某个进程并关闭】。
《www.micoder.cc》
虚拟化云计算,系统运维,安全技术服务.
Tags: | [阅读全文...] |
最新评论