【问题标题】:How to prevent Spring MVC application to shutdown after closing the terminal?如何防止 Spring MVC 应用程序在关闭终端后关闭?
【发布时间】:2013-11-25 01:11:47
【问题描述】:

我有一个使用普通 SpringApplication.run(Application.class, args); 运行的 Spring MVC 应用程序;陈述。当我运行它然后关闭终端窗口时,它会终止该进程。当我关闭终端窗口时,如何防止它关闭?

我使用的是 OSX 10.9,Mavericks。

非常感谢。

【问题讨论】:

  • 你不能运行你的java 命令,最后加上& 吗?

标签: java spring spring-boot


【解决方案1】:

正如 Dave Syer 所说,您最好使用 nohup 命令,这将防止子进程在终端窗口关闭时挂起。

例如:

nohup java -jar name.jar 2>&1 >output.log &

这会将标准输出和标准错误发送到output.log 文件。您可以省略>output.log,而nohup 将使用名为nohup.out 的默认日志文件。

【讨论】:

  • 谢谢@Anju。如果答案对你有用,你能接受吗?
猜你喜欢
  • 1970-01-01
  • 2019-09-18
  • 1970-01-01
  • 2015-07-01
  • 2019-11-01
  • 2011-02-25
  • 1970-01-01
相关资源
最近更新 更多