From 298f2c066ad2141c4a8368388e07dc78123d6076 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 24 Jul 2018 12:42:52 -0400 Subject: [PATCH] BF: account that now code 255 is the one to say "it is Ok, we are already running/stopped" --- files/debian-initd | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/files/debian-initd b/files/debian-initd index 9a701d98..a7d5c6e6 100755 --- a/files/debian-initd +++ b/files/debian-initd @@ -180,11 +180,17 @@ do_reload() { # log_end_msg_wrapper() { - [ $1 -lt $2 ] && value=0 || value=1 + if [ $1 != 0 ] && [ $1 != $2 ]; then + value=1 + else + value=0 + fi if [ "$3" != "no" ]; then log_end_msg $value fi - exit $value + if [ $code != 0 ]; then + exit $1 + fi } command="$1" @@ -192,13 +198,13 @@ case "$command" in start|force-start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start "$command" - log_end_msg_wrapper $? 2 "$VERBOSE" + log_end_msg_wrapper $? 255 "$VERBOSE" ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop - log_end_msg_wrapper $? 2 "$VERBOSE" + log_end_msg_wrapper $? 255 "$VERBOSE" ;; restart|force-reload) @@ -207,7 +213,7 @@ case "$command" in case "$?" in 0|1) do_start - log_end_msg_wrapper $? 1 "always" + log_end_msg_wrapper $? 0 "always" ;; *) # Failed to stop