scheduler_center.py为我要杀掉的进程
# ps -ef|grep scheduler_center.py root 12013 python3 scheduler_center.py root 12030 grep --color=auto scheduler_center.py # ps -ef|grep scheduler_center.py|grep -v grep root 12013 python3 scheduler_center.py
grep -v grep打印出来的信息少一条
杀死进程完整的指令
ps -ef|grep scheduler_center.py|grep -v grep|awk '{print "kill -9 "$2}'|sh
解释:
awk '{print "kill -9 "$2}'打印进程id到屏幕
sh执行之前的打印
参考