简体   繁体   中英

Run spring boot shell as daemon

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.

You probably have to disable the interactive shell with:

spring.shell.interactive.enabled=false

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