Systemd Zookeeper service failed

dsafa picture dsafa · Nov 15, 2016 · Viewed 14.4k times · Source

I've created the following systemd service script for running Zookeeper using Ansible:

[Unit]
Description=ZooKeeper

[Service]
User=root
Type=forking
User=zookeeper
Group=zookeeper
ExecStart=/tmp/zookeeper-3.4.9/bin/zkServer.sh start
ExecStop=/tmp/zookeeper-3.4.9/bin/zkServer.sh stop

TimeoutSec=300

[Install]
WantedBy=multi-user.target 

But, while trying to run the script using sudo service zookeeper start I get the following error:

Nov 15 22:00:35 sharedservicesprovider systemd[1]: Starting ZooKeeper...
-- Subject: Unit zookeeper.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit zookeeper.service has begun starting up.
Nov 15 22:00:35 sharedservicesprovider systemd[15287]: zookeeper.service: Failed at step USER spawning /tmp/zookeeper-3.4.9/bin/zkServer.sh: No such process
-- Subject: Process /tmp/zookeeper-3.4.9/bin/zkServer.sh could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /tmp/zookeeper-3.4.9/bin/zkServer.sh could not be executed and failed.
-- 
-- The error number returned by this process is 3.
Nov 15 22:00:35 sharedservicesprovider systemd[1]: zookeeper.service: Control process exited, code=exited status=217
Nov 15 22:00:35 sharedservicesprovider systemd[1]: Failed to start ZooKeeper.
-- Subject: Unit zookeeper.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Any hint onto why I am unable to start Zookeeper properly since I'm quite new to system services?

Answer

Valentin Palacios picture Valentin Palacios · Feb 7, 2018

Maybe so late... but use as ExecStart:

/tmp/zookeeper-3.4.9/bin/zkServer.sh start-foreground