spring-boot-assembly icon indicating copy to clipboard operation
spring-boot-assembly copied to clipboard

shutdown 那个写法有问题

Open abc582915847 opened this issue 6 years ago • 0 comments

如果 我这个包在一个机器部署多个,只是端口不同,这样的话 kill 会把所有进程都 kill 掉,并不是我期望的那样,我的写法如下 #!/bin/bash jarName='xxxx.jar' port=8085 mainClass='org.xxx.api.Application' #pid=$(ps -ef | grep $jarName | grep -v grep | awk '{print $2}') pid=$(lsof -i:$port | grep -v COMMAND | awk '{print $2}') kill -9 $pid nohup java -cp $jarName:./lib/* -server -Dspring.config.location=file:./config/ -Dserver.port=$port $mainClass & >/dev/null

abc582915847 avatar Nov 08 '19 02:11 abc582915847