无法启动springboot应用程序的systemd服务

时间:2017-04-23 15:02:24

标签: ubuntu spring-boot systemd

我按照spring documentation for creating systemd service为我的springboot app创建了一个启动脚本。

仅供参考:我在github上看到this已解决的问题,该问题表明该问题属于权限问题但对我来说不起作用,该jar有755的权限。

这是我的服务说明:

[Unit]
Description=gs-spring-boot-0.1.0
After=syslog.target

[Service]
ExecStart=/home/user/deploy/gs-spring-boot-0.1.0.jar
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

当我尝试启用这样的服务时:

sudo systemctl enable  gs-spring-boot-0.1.0.service

我收到此错误:

update-rc.d: error: gs-spring-boot-0.1.0 Default-Start contains no runlevels, aborting.

当我检查状态时,这是输出: enter image description here

enter image description here

注意:我使用的是ubuntu,jar文件有权限:755

感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

抱歉,将其添加到build.gradle是解决方案:

bootRepackage { executable = true }

它使jar可执行。即添加此代码后,您应该能够使用以下命令运行应用程序:

./app-name.jar
相关问题