Spring 引导 init.d 不 不 运行(未找到进程)
Spring Boot init.d not Not running (process not found)
我试图按照 here 中的说明进行操作,其中尝试 运行 Spring 将应用程序作为 init.d 服务启动,但未能成功。
我如上所述创建了完全可执行的 jar (myapp.jar),还创建了指向 /etc/init.d/myapp 的符号链接,当我 运行 java -jar myapp.jar 我可以看到应用程序成功启动。
但是当我尝试使用
service myapp status
它说 Not running (process not found)
service myapp start
它说 Failed to start
文档说“假设您在 /var/myapp 中安装了 Spring 启动应用程序”,我不太理解这一点。我将可执行 jar(通过 Jenkins)复制到 /var/myapp。所以它只包含一个 jar 文件。这会造成问题吗?
如有任何建议,我们将不胜感激。
环境:
springBootVersion = '1.3.2.RELEASE'
JDK6 (yes it is)
Ubuntu 12.04
您必须将您的 jar 注册为服务。看看http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#deployment-initd-service
有时,您可能需要 运行: sudo systemctl daemon-reload
才能加载新服务。
在 ubuntu 中,您需要使用 sudo systemctl daemon-reload
重新加载守护进程
我试图按照 here 中的说明进行操作,其中尝试 运行 Spring 将应用程序作为 init.d 服务启动,但未能成功。
我如上所述创建了完全可执行的 jar (myapp.jar),还创建了指向 /etc/init.d/myapp 的符号链接,当我 运行 java -jar myapp.jar 我可以看到应用程序成功启动。
但是当我尝试使用
service myapp status
它说 Not running (process not found)
service myapp start
它说 Failed to start
文档说“假设您在 /var/myapp 中安装了 Spring 启动应用程序”,我不太理解这一点。我将可执行 jar(通过 Jenkins)复制到 /var/myapp。所以它只包含一个 jar 文件。这会造成问题吗?
如有任何建议,我们将不胜感激。
环境:
springBootVersion = '1.3.2.RELEASE'
JDK6 (yes it is)
Ubuntu 12.04
您必须将您的 jar 注册为服务。看看http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#deployment-initd-service
有时,您可能需要 运行: sudo systemctl daemon-reload
才能加载新服务。
在 ubuntu 中,您需要使用 sudo systemctl daemon-reload