linux启动jar包(查询进程ID并且kill)

xiaoxiao2025-06-10  35

#!/bin/sh

count=$(netstat -nl | grep -w 8099 | sed -r 's#.* (.*)/.*#\1#'| wc -l)

if [ 0 == $count ]; then    nohup java -jar /aaa.jar --spring.config.location=/aaa/application.yml >/aaa/nohup.out &    tail -f nohup.out else    kill -9 $(ps -ef | grep order|grep -v grep | awk '{print $2}')

   nohup java -jar /aaa.jar --spring.config.location=/aaa/application.yml >/aaa/nohup.out &

   tail -f nohup.out fi

转载请注明原文地址: https://www.6miu.com/read-5031610.html

最新回复(0)