control: tags -1 patch I believe this patch is adequate solution:
From 26e4989597d0fca9348443721c512f2b6774971c Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov <kact...@debian.org> Date: Sun, 24 Mar 2019 22:18:22 +0000 Subject: [PATCH] Make init-d-scripts exit with sensible values (Closes: #427889) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to Policy=4.3.0.3, The "init.d" scripts must ensure that they will behave sensibly (i.e., returning success and not starting multiple copies of a service) if invoked with "start" when the service is already running, or with "stop" when it isn’t, and that they don’t kill unfortunately-named user processes. This patch ensures, that exit values, returned by start-stop-daemon(8) are sensible and propagated correctly into do_{start,stop,restart} functions. Unfortunately, as resolved in #426877, --oknodo option is opt-in, and default behaviour of start-stop-daemon is non-sensible with regard of starting/stopping daemon, already running/stopped. --- debian/init-d-script | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/debian/init-d-script b/debian/init-d-script index 131dbd65..59ae3221 100755 --- a/debian/init-d-script +++ b/debian/init-d-script @@ -43,22 +43,10 @@ call() { # Function that starts the daemon/service # -# Return -# 0 if daemon has been started -# 1 if daemon was already running -# 2 if daemon could not be started do_start_cmd() { - start-stop-daemon --start --quiet ${PIDFILE:+--pidfile ${PIDFILE}} \ - $START_ARGS \ - --startas $DAEMON --name $NAME --exec $DAEMON --test > /dev/null \ - || return 1 - start-stop-daemon --start --quiet ${PIDFILE:+--pidfile ${PIDFILE}} \ - $START_ARGS \ - --startas $DAEMON --name $NAME --exec $DAEMON -- $DAEMON_ARGS \ - || return 2 - # Add code here, if necessary, that waits for the process to be ready - # to handle requests from services started subsequently which depend - # on this one. As a last resort, sleep for some time. + start-stop-daemon --start --quiet --oknodo \ + ${PIDFILE:+--pidfile ${PIDFILE}} $START_ARGS \ + --startas $DAEMON --name $NAME --exec $DAEMON -- $DAEMON_ARGS } do_start() @@ -68,12 +56,15 @@ do_start() fi [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" call do_start_cmd - case "$?" in + retval=$? + case ${retval} in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac if is_call_implemented do_start_cleanup ; then call do_start_cleanup + else + return ${retval} fi } @@ -81,11 +72,6 @@ do_start() # Function that stops the daemon/service # -# Return -# 0 if daemon has been stopped -# 1 if daemon was already stopped -# 2 if daemon could not be stopped -# other if a failure occurred do_stop_cmd() { start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ $STOP_ARGS \ @@ -114,12 +100,15 @@ do_stop() fi [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" call do_stop_cmd - case "$?" in + retval=$? + case ${retval} in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac if is_call_implemented do_stop_cleanup ; then call do_stop_cleanup + else + return ${retval} fi } @@ -130,12 +119,15 @@ do_restart() { [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME" call do_stop_cmd call do_start_cmd - case "$?" in + retval=$? + case ${retval} in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac if is_call_implemented do_restart_cleanup ; then call do_restart_cleanup + else + return ${retval} fi } -- Note, that I send and fetch email in batch, once every 24 hours. If matter is urgent, try https://t.me/kaction --
pgpzdbvR43eVZ.pgp
Description: PGP signature