导航

 
#!/bin/sh  
TOM_HOME=$1 
ps -ef|grep $TOM_HOME|grep -v grep|grep -v kill  
if [ $? -eq 0 ];then  
kill -9 `ps -ef|grep $TOM_HOME|grep -v grep|grep -v kill|awk '{print $2}'`  
else  
echo $TOM_HOME' No Found Process'  
fi 

  使用时,保存成文件,比如killps.sh 。然后killps 进程名即可

#!/bin/sh TOM_HOME=$1 ps -ef|grep $TOM_HOME|grep -v grep|grep -v kill if [ $? -eq 0 ];then kill -9 `ps -ef|grep $TOM_HOME|grep -v grep|grep -v kill|awk '{print $2}'` else echo $TOM_HOME' No Found Process' fi

posted on 2021-01-22 17:31  slqt  阅读(253)  评论(0编辑  收藏  举报