问题
I have tried the run spring boot jar file using putty. but the problem is after closed the putty session service was stopped.
回答1:
then i tried up the jar file with following command. its working fine .
**nohup java -jar /web/server.jar **
回答2:
You should avoid using nohup as it will just disassociate your terminal and the process. Instead, use the following command to run your process as a service.
sudo ln -s /path/to/your-spring-boot-app.jar /etc/init.d/your-spring-boot-app
This command creates a symbolic link to your JAR file. Which then, you can run as a service using the command sudo service your-spring-boot-app start
. This will write console log to /var/log/your-spring-boot-app.log
Moreover, you can configure spring-boot/application.properties
to write console logs at your specified location using logging.path=path-to-your-log-directory
or logging.file=path-to-your-log-file.txt
. Also, it may be worth noting that logging.file
takes priority over logging.path
来源:https://stackoverflow.com/questions/47311369/jar-file-run-on-a-server-background-with-close-putty-session