[RFC PATCH 05/12] init-d-script: return 0 when cmd_override does nothing

Trek trek00 at inbox.ru
Thu Jul 2 18:18:44 BST 2020


When do_start_cmd_override is called and the process is already
running, then it should return 1, but do_start should return 0 in
that case. Same apply to do_stop_cmd_override when the process is
not running.

Also restore do_start_cmd and do_stop_cmd to return 1, useful when
the override function calls do_start_cmd or do_stop_cmd and it needs
to know if nothing was done.
---
 debian/init-d-script | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/debian/init-d-script b/debian/init-d-script
index deca02f5..17fdb75e 100755
--- a/debian/init-d-script
+++ b/debian/init-d-script
@@ -44,7 +44,7 @@ call() {
 #
 
 do_start_cmd() {
-	start-stop-daemon --start --quiet --oknodo \
+	start-stop-daemon --start --quiet \
 	    $START_ARGS \
 	    ${PIDFILE:+--pidfile "$PIDFILE"} \
 	    ${COMMAND_NAME:+--name "$COMMAND_NAME"} \
@@ -60,7 +60,7 @@ do_start()
 	call do_start_cmd
 	retval=$?
 	case ${retval} in
-		0|1) vlog_end_msg 0 ;;
+		0|1) vlog_end_msg 0; retval=0 ;;
 		*) vlog_end_msg 1 ;;
 	esac
 	if is_call_implemented do_start_cleanup ; then
@@ -75,7 +75,7 @@ do_start()
 #
 
 do_stop_cmd() {
-	start-stop-daemon --stop --quiet --oknodo --retry=TERM/30/KILL/5 \
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
 	    $STOP_ARGS \
 	    ${PIDFILE:+--pidfile "$PIDFILE"} \
 	    ${COMMAND_NAME:+--name "$COMMAND_NAME"} \
@@ -107,7 +107,7 @@ do_stop()
 	call do_stop_cmd
 	retval=$?
 	case ${retval} in
-		0|1) vlog_end_msg 0 ;;
+		0|1) vlog_end_msg 0; retval=0 ;;
 		*)   vlog_end_msg 1 ;;
 	esac
 	if is_call_implemented do_stop_cleanup ; then
@@ -126,7 +126,7 @@ do_restart() {
 	call do_start_cmd
 	retval=$?
 	case ${retval} in
-		0|1) vlog_end_msg 0 ;;
+		0|1) vlog_end_msg 0; retval=0 ;;
 		*)   vlog_end_msg 1 ;;
 	esac
 	if is_call_implemented do_restart_cleanup ; then
-- 
2.20.1





More information about the Debian-init-diversity mailing list