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