!/bin/sh
根据进程名杀死进程
PROCESS=ps -ef|grep GetDeviceData.py|grep -v grep|grep -v PPID|awk '{ print $2}'
for i in $PROCESS
do
echo "Kill the GetDeviceData.py process [ $i ]"
kill -9 $i
done
上面这段代码只能杀死 GetDeviceData.py的进程,那么如何同时杀死多个进程呢?
PROCESS=ps -ef|grep GetDeviceData.py|grep -v grep|grep -v PPID|awk '{ print $2}'
for i in $PROCESS
do
echo "Kill the GetDeviceData.py process [ $i ]"
kill -9 $i
done
上面这段代码只能杀死 GetDeviceData.py的进程,那么如何同时杀死多个进程呢?
7 回答5.3k 阅读
4 回答4k 阅读
2 回答5.9k 阅读✓ 已解决
2 回答2.5k 阅读✓ 已解决
1 回答2.3k 阅读✓ 已解决
2 回答794 阅读✓ 已解决
2 回答3.2k 阅读
找到解决方法了:kill -9 $(ps -ef|grep -E 'aprogram|bprogram|c'|grep -v grep|awk '{print $2}')