linux查找某进程id并杀掉

 

#!/bin/sh
tomcat_id=$(ps -ef | grep tomcat | grep -v "grep" | awk '{print $2}') for tomcatid in $tomcat_id do kill -9 ${tomcatid} echo "killed tomcat_id $tomcatid" done sh /data/4a/tomcat/bin/startup.sh echo "restart tomcat..."

 

 

#"--------4a--------"tomcat_id=$(ps -ef | grep tomcat | grep -v "grep" | awk '{print $2}')for tomcatid in $tomcat_iddo    kill -9 ${tomcatid}        echo "killed tomcat_id $tomcatid"   donesh /data/4a/tomcat/bin/startup.shecho "restart tomcat..." 

posted @ 2020-02-14 17:22  君子笑而不语  阅读(2028)  评论(0编辑  收藏  举报