linux杀死java进程脚本

linux杀死java进程脚本例子(使用时换成自己的端口即可)

echo "kill start..."
PID1=$(lsof -i:8201|grep -v grep|awk '{print $2}')
PID2=$(lsof -i:8401|grep -v grep|awk '{print $2}')
PID3=$(lsof -i:8080|grep -v grep|awk '{print $2}')
PID4=$(lsof -i:8088|grep -v grep|awk '{print $2}')
if [ -z $PID1 ]; then
        echo "gateway process not exist"
else
        echo "gateway process id: $PID1"
        kill -9 ${PID1}
        echo "gateway process be killed"
fi
if [ -z $PID2 ]; then
        echo "auth process not exist"
        
else
        echo "auth process id: $PID2"
        kill -9 ${PID2}
        echo "auth process be killed"
fi
if [ -z $PID3 ]; then
        echo "admin process not exist"
        
else
        echo "admin process id: $PID3"
        kill -9 ${PID3}
        echo "admin process be killed"
fi
if [ -z $PID4 ]; then
        echo "portal process not exist"
        
else
        echo "portal process id: $PID4"
        kill -9 ${PID4}
        echo "portal process be killed"
fi
echo "all process be killed"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值