有时候需要批量杀某些进程,每次写一长条真麻烦
vi /usr/local/bin/killkeys
pids="`ps -ef |grep "$1" |grep -v -e grep -e killkeys |awk '{print $2}'`" if [ -z "$pids" ];then #echo empty exit 0 fi echo "kill pid:"$pids kill -9 $pids
chmod 777 /usr/local/bin/killkeys
以杀rocketmq为例,效果达到预期