On Ubuntu: don't start Zookeeper twice

On Ubuntu, if the Zookeeper service is already running, attempting
to start it again fails with non-zero exit code. This patch detects
whether ZK is already started before trying to start it.

Change-Id: If1257152de01fe5fe0351fdbb538bce083edbec0
Closes-Bug: #1513741
This commit is contained in:
Jordan Pittier 2015-11-10 18:58:11 +01:00
parent ef0d320981
commit 04e73e17e8
1 changed files with 6 additions and 1 deletions

View File

@ -69,7 +69,12 @@ function install_zookeeper {
# start_zookeeper() - Start running processes, including screen
function start_zookeeper {
start_service zookeeper
# Starting twice Zookeeper on Ubuntu exits with error code 1. See LP#1513741
# Match both systemd and sysvinit output
local running="(active \(running\)|start/running)"
if ! is_ubuntu || ! sudo /usr/sbin/service zookeeper status | egrep -q "$running"; then
start_service zookeeper
fi
}
# stop_zookeeper() - Stop running processes (non-screen)