From 74cf6157ef0d8788a56aed65a85b722ccb50e398 Mon Sep 17 00:00:00 2001 From: Cyprian Gracz Date: Tue, 25 Oct 2016 10:12:59 +0200 Subject: [PATCH] Stop returns 0 when docker service was not running In case when docker was not running init script stop was returning value <> 0. Due to this fact it was impossible to uninstall the docker-engine if the docker service was stopped. Signed-off-by: Cyprian Gracz Fixed message logging Signed-off-by: Cyprian Gracz --- contrib/init/sysvinit-debian/docker | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/contrib/init/sysvinit-debian/docker b/contrib/init/sysvinit-debian/docker index 4f9d38dda5..9c8fa6be73 100755 --- a/contrib/init/sysvinit-debian/docker +++ b/contrib/init/sysvinit-debian/docker @@ -119,9 +119,13 @@ case "$1" in stop) check_init fail_unless_root - log_begin_msg "Stopping $DOCKER_DESC: $BASE" - start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" --retry 10 - log_end_msg $? + if [ -f "$DOCKER_SSD_PIDFILE" ]; then + log_begin_msg "Stopping $DOCKER_DESC: $BASE" + start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" --retry 10 + log_end_msg $? + else + log_warning_msg "Docker already stopped - file $DOCKER_SSD_PIDFILE not found." + fi ;; restart)