MagGGG
MagGGG

Reputation: 20936

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.

Upvotes: 5

Views: 5847

Answers (4)

Dejazmach
Dejazmach

Reputation: 800

If you are deploying your executable jar

nohup java -jar <your jar name>

Upvotes: 2

so-random-dude
so-random-dude

Reputation: 16465

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?

Upvotes: 3

M S
M S

Reputation: 129

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.

Upvotes: 7

Vasu
Vasu

Reputation: 22422

In putty, you need to use nohup mvn spring-boot:run > spring-log.txt & to run the command in the background and this generates the spring-log.txt file.

Upvotes: 3

Related Questions