简体   繁体   中英

How to keep springboot application alive after exiting putty

I am running my spring boot application on my server using putty via command mvn spring-boot:run and it runs only when I have open ssh session. Is it possible to keep application alive after I disconnect session? Or do I have to make executable war file and deploy to installed tomcat server on my ubunntu 14.04. I know others ways to deploy boot apps but I want to know if it is possible in my approach.

You can run the command in the background and with nohup like so

nohup mvn spring-boot:run &

When you do this, the application runs in background even after you close ssh session.

在putty中,你需要使用nohup mvn spring-boot:run > spring-log.txt &在后台运行命令,这会生成spring-log.txt文件。

If you don't want console logs to be written (you have logging frameworks which handles the application logs) then use this command

nohup mvn spring-boot:run </dev/null >/dev/null 2>&1 & 

BTW, just curious, why are you using mvn spring-boot:run to run your program in your server? doesn't that require you to have maven runtime installed in your server as well?

如果要部署可执行jar

nohup java -jar <your jar name>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM