centos7下按springboot官方文档做systemd service出错

xdjames 发布于 2017/02/15 16:07
阅读 397
收藏 0

各位好,今天按spring boot reference(http://docs.spring.io/spring-boot/docs/1.5.1.RELEASE/reference/htmlsingle/#deployment-systemd-service)文档章节"59.1.2 Installation as a systemd service"中的教程,尝试在centos 7下将springboot程序做成系统服务随系统开机自启动,以下为service的配置文件

[Unit]
Description=javafx-demo
After=syslog.target

[Service]
User=root
ExecStart=/usr/local/engin-deploy/javafx/spring-boot-javafx-demo.jar
#ExecStart=/usr/local/engin-deploy/javafx/run.sh
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

若ExecStart=/usr/local/engin-deploy/javafx/spring-boot-javafx-demo.jar

服务启动时用systemctl status查看,报如下错误

● javafx-demo.service - javafx-demo
   Loaded: loaded (/etc/systemd/system/javafx-demo.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 三 2017-02-15 16:03:58 CST; 4s ago
  Process: 4225 ExecStart=/usr/local/engin-deploy/javafx/spring-boot-javafx-demo.jar (code=exited, status=203/EXEC)
 Main PID: 4225 (code=exited, status=203/EXEC)

2月 15 16:03:58 localhost systemd[1]: Started javafx-demo.
2月 15 16:03:58 localhost systemd[1]: Starting javafx-demo...
2月 15 16:03:58 localhost systemd[1]: javafx-demo.service: main process exited, code=exi...XEC
2月 15 16:03:58 localhost systemd[1]: Unit javafx-demo.service entered failed state.
2月 15 16:03:58 localhost systemd[1]: javafx-demo.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

后改成ExecStart=/usr/local/engin-deploy/javafx/run.sh

服务启动时用systemctl status查看,报如下错误

[root@localhost ~]# systemctl status javafx-demo.service
● javafx-demo.service - javafx-demo
   Loaded: loaded (/etc/systemd/system/javafx-demo.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 三 2017-02-15 15:34:59 CST; 3min 1s ago
  Process: 666 ExecStart=/usr/local/engin-deploy/javafx/run.sh (code=exited, status=127)
 Main PID: 666 (code=exited, status=127)

2月 15 15:34:53 localhost.localdomain systemd[1]: Started javafx-demo.
2月 15 15:34:53 localhost.localdomain systemd[1]: Starting javafx-demo...
2月 15 15:34:53 localhost.localdomain run.sh[666]: /usr/local/engin-deploy/j…令
2月 15 15:34:59 localhost.localdomain systemd[1]: javafx-demo.service: main ...
2月 15 15:34:59 localhost.localdomain systemd[1]: Unit javafx-demo.service e...
2月 15 15:34:59 localhost.localdomain systemd[1]: javafx-demo.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

不知可有人遇到相通的问题???

加载中
0
一只菜鸟
一只菜鸟

推荐看下《Spring Boot 系列学习 》,里面有详细讲解

返回顶部
顶部