0

I have an Spring boot web-application with an interactive shell for configuration. I want to run my app as daemon to start server. When I run it normally using java -jar app.jar I get an interactive shell and also I can connect to server using web-browser. but sometimes I want to run it as background on a VPS.

When I run it using nohub with a bash script like following it run but not as daemon and when I close SSH it stop working.

#!/bin/sh
nohup java -jar /web/server.jar &

When I run it as service using ln -s /var/jar-file /etc/init.d/app and call service app start it get error and couldn't run.

When I run it using java -jar app.jar > /var/log/app.log 2>&1 it starts well but by closing the SSH it stop.

MTM
  • 113
  • 1
  • 8
  • 1
    Strange. `nohup` should've worked. What did you mean by your process not running as daemon when using nohup? Do you see the live application logs in terminal? – Akhil Bojedla Dec 31 '21 at 09:30
  • I see terminal waiting for my input without showing output logs @AkhilBojedla – MTM Jan 01 '22 at 03:25
  • Strange indeed. It is possible that you are not seeing your prompt because your command is still delivering stderr messages to your console. Try using `> logs.txt 2>&1 – Akhil Bojedla Jan 07 '22 at 16:38

1 Answers1

0

You probably have to disable the interactive shell with:

spring.shell.interactive.enabled=false
mtricht
  • 427
  • 4
  • 16