Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shutdown 那个写法有问题 #10

Open
abc582915847 opened this issue Nov 8, 2019 · 0 comments
Open

shutdown 那个写法有问题 #10

abc582915847 opened this issue Nov 8, 2019 · 0 comments

Comments

@abc582915847
Copy link

如果 我这个包在一个机器部署多个,只是端口不同,这样的话 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant