- 编写脚本
vim kill9.sh
#!/bin/bash
pid1=$(ps -ef | grep 进程名1| awk '{print $2}')
pid2=$(ps -ef | grep 进程名2| awk '{print $2}')
pid3=$(ps -ef | grep 进程名3| awk '{print $2}')
pid4=$(ps -ef | grep 进程名4| awk '{print $2}')
pid5=$(ps -ef | grep 进程名5| awk '{print $2}')
pid6=$(ps -ef | grep 进程名6| awk '{print $2}')for pid in {$pid1,$pid2,$pid3,$pid4,$pid5,$pid6}
do
kill -9 $pid
done
-
授权,可执行权限
chmod u+x kill9.sh
-
执行脚本
./kill9.sh