首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >启动Apache Gobblin时自定义服务systemd出现问题

启动Apache Gobblin时自定义服务systemd出现问题
EN

Stack Overflow用户
提问于 2019-01-21 00:50:07
回答 1查看 47关注 0票数 0

直接运行/opt/gobblin/bin/gobblin-standalone.sh start一切正常,日志中的输出也很好。

通过systemd服务运行它是行不通的。日志中没有输出任何内容。

代码语言:javascript
复制
[vagrant@localhost ~]$ sudo systemctl start gobblin
[vagrant@localhost ~]$ sudo systemctl status gobblin
● gobblin.service - Gobblin Data Ingestion Framework
   Loaded: loaded (/usr/lib/systemd/system/gobblin.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Sun 2019-01-20 16:44:23 UTC; 693ms ago
     Docs: https://gobblin.readthedocs.io
  Process: 9673 ExecStop=/opt/gobblin/bin/gobblin-standalone.sh stop (code=exited, status=1/FAILURE)
  Process: 9671 ExecStart=/opt/gobblin/bin/gobblin-standalone.sh start (code=exited, status=1/FAILURE)
 Main PID: 9671 (code=exited, status=1/FAILURE)

Jan 20 16:44:23 localhost.localdomain systemd[1]: gobblin.service: control process exited, code=exited status=1
Jan 20 16:44:23 localhost.localdomain systemd[1]: Unit gobblin.service entered failed state.
Jan 20 16:44:23 localhost.localdomain systemd[1]: gobblin.service failed.
Jan 20 16:44:23 localhost.localdomain systemd[1]: gobblin.service holdoff time over, scheduling restart.
Jan 20 16:44:23 localhost.localdomain systemd[1]: Stopped Gobblin Data Ingestion Framework.
Jan 20 16:44:23 localhost.localdomain systemd[1]: start request repeated too quickly for gobblin.service
Jan 20 16:44:23 localhost.localdomain systemd[1]: Failed to start Gobblin Data Ingestion Framework.
Jan 20 16:44:23 localhost.localdomain systemd[1]: Unit gobblin.service entered failed state.
Jan 20 16:44:23 localhost.localdomain systemd[1]: gobblin.service failed.

/usr/lib/systemd/system/gobblin.service的代码如下:

代码语言:javascript
复制
[Unit]
Description=Gobblin Data Ingestion Framework
Documentation=https://gobblin.readthedocs.io
After=network.target

[Service]
Type=simple
User=gobblin
Group=gobblin
WorkingDirectory=/opt/gobblin
ExecStart=/opt/gobblin/bin/gobblin-standalone.sh start
ExecStop=/opt/gobblin/bin/gobblin-standalone.sh stop
Restart=on-failure

[Install]
WantedBy=multi-user.target
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-21 01:23:24

诀窍是使用Type=oneshotRemainAfterExit=true和设置环境:

代码语言:javascript
复制
[Unit]
Description=Gobblin Data Ingestion Framework
Documentation=https://gobblin.readthedocs.io
After=network.target

[Service]
Type=oneshot
User=gobblin
Group=gobblin
WorkingDirectory=/opt/gobblin
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre
Environment=GOBBLIN_FWDIR=/opt/gobblin
Environment=GOBBLIN_JOB_CONFIG_DIR=/etc/gobblin
Environment=GOBBLIN_WORK_DIR=/var/lib/gobblin
Environment=GOBBLIN_LOG_DIR=/var/log/gobblin
ExecStart=/opt/gobblin/bin/gobblin-standalone.sh start
ExecStop=/opt/gobblin/bin/gobblin-standalone.sh stop
RemainAfterExit=true

[Install]
WantedBy=multi-user.target
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54278704

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档