shell 结束指定端口

ps aux|grep java|grep -v grep |grep -v tomcat-1001|grep -v "java -server"|awk '{print $2}'|xargs kill -9


ps -ef|grep "tomcat-10101" |grep -v "grep"|awk '{printf $2}'


##############判断是否存在进程#############

#!/bin/sh

pid=`ps aux|grep elasticsearch-linux-x86-64|grep -v grep|awk '{print $2}'`

echo "$pid ====>"

if [ ! -n $pid ] ; then

        echo 'bucunzai'

else

        echo "cunzai ${pid}"

fi


你可能感兴趣的:(shell 结束指定端口)