linjiqin

一、shell查找进程并杀死

#!/bin/sh

tomcat_id=`ps -ef | grep tomcat | grep -v "grep" | awk \'{print $2}\'`
echo $tomcat_id

for id in $tomcat_id
do
    kill -9 $id  
    echo "killed $id"  
done

注意:tomcat表示要查找的程序进程名,如:tomcat、8081端口、redis等等。

二、linux查找进程并杀死

#####查找tomcat进程
ps -ef | grep tomcat | grep -v grep | awk \'{print $2}\'
#####查找tomcat进程并杀死
ps -ef | grep tomcat | grep -v grep | awk \'{print $2}\' | xargs kill -9
 

 

分类:

技术点:

相关文章:

  • 2021-11-20
  • 2021-10-30
  • 2021-08-30
  • 2021-12-24
  • 2021-11-20
  • 2022-12-23
猜你喜欢
  • 2022-01-26
  • 2021-11-20
  • 2022-12-23
  • 2021-12-29
  • 2021-11-20
  • 2021-11-20
  • 2022-12-23
相关资源
相似解决方案