Running /opt/gobblin/bin/gobblin-standalone.sh start
directly everything works, the output in logs are fine.
Running it through a systemd service, not works. Nothing are outputting in logs.
[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.
The code of /usr/lib/systemd/system/gobblin.service
below:
[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
The trick is with Type=oneshot
, RemainAfterExit=true
and set the environments:
[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