SpringBoot项目运行一段时间后自动关闭的问题
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
·
最近自己写的小项目发布到linux上总是运行一段时间后关闭,查看日志:
Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@707194ba: startup date [Tue Jun 19 16:39:22 CST 2018]; root of context hierarchy
Unregistering JMX-exposed beans on shutdown
Unregistering JMX-exposed beans
解决方案
用java -jar XXX.jar >/dev/null 2>&1 &
启动后项目看似脱离终端了,其实还是受终端影响,断开xshell之后,项目过段时间就会挂了。GG。
把启动语句加上nohup后台运行就可以了。
nohup java -jar XXX.jar >/dev/null 2>&1 &
nohup是什么
用途:nohup是linux一个命令,不挂断地运行,或者理解为后台运行。
语法:nohup Command [ Arg … ] [ & ]
无论是否将 nohup 命令的输出重定向到终端,输出都将附加到当前目录的 nohup.out 文件中。
如果当前目录的 nohup.out 文件不可写,输出重定向到 $HOME/nohup.out 文件中。
如果没有文件能创建或打开以用于追加,那么 Command 参数指定的命令不可调用。
退出状态:该命令返回下列出口值:
126 可以查找但不能调用 Command 参数指定的命令。
127 nohup 命令发生错误或不能查找由 Command 参数指定的命令。
否则,nohup 命令的退出状态是 Command 参数指定命令的退出状态
A beautiful web dashboard for Linux
最近提交(Master分支:3 个月前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)