对于进程比较多的情况下,如何批量删除进程呢,这里就用到了shell脚本,
1.首先提取出一个进程号,然后kill -9 进程号,然后写在一个for循环里
2.提取出所有的进程号,然后kill -9 所有的进程号
ps -ef | grep python查询进程
/home/rca/vitrage # ps -ef | grep python
309 root 12:46 python start.py
355 root 0:20 python start.py
356 root 0:59 python start.py
357 root 0:01 python start.py
358 root 0:09 python start.py
359 root 0:19 python start.py
360 root 0:20 python start.py
361 root 0:18 python start.py
371 root 0:10 python start.py
753 root 0:00 [python]
757 root 0:00 grep python
1.kill.sh内容如下
#!/bin/sh
for i in ps -ef |grep python | awk '{print $1}'
;
do
kill -9 $i;
done
2.kill.sh内容如下
a=ps -ef |grep python | awk '{print $1}'
kill -9 $a
shell 批量删除进程脚本
于 2019-05-07 14:59:54 首次发布