Jar file run on a server background with close putty session

时光总嘲笑我的痴心妄想 提交于 2019-12-22 00:15:11

问题


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-directoryor 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!