Bug#1108969: sysvinit-utils: add common support for oneshot services in init-d-script helper

Mark Hindley mark at hindley.org.uk
Mon Sep 15 08:22:55 BST 2025


Hi,

I think this is better to avoid an error when stopping an already stopped
oneshot service.

Mark

commit 5125062c9653b9a3be0462f889d62b9ef929d05a
Author: Mark Hindley <mark at hindley.org.uk>
Date:   Mon Sep 15 08:19:19 2025 +0100

    Avoid error when stopping already stopped oneshot which is no-op.

diff --git a/debian/init-d-script b/debian/init-d-script
index 7761426c..487fbc38 100755
--- a/debian/init-d-script
+++ b/debian/init-d-script
@@ -49,7 +49,7 @@ oneshot() {
 		setup) mkdir -p "$IDS_RUNDIR" ;;
 		start-pre) [ -f /$IDS_RUNDIR/$NAME.oneshot ] && exit ;;
 		start-post) touch /$IDS_RUNDIR/$NAME.oneshot ;;
-		stop-pre) [ -f /$IDS_RUNDIR/$NAME.oneshot ] || exit ;;
+		stop-pre) [ ! -f /$IDS_RUNDIR/$NAME.oneshot ] && exit ;;
 		stop-post) rm -f /$IDS_RUNDIR/$NAME.oneshot ;;
 		status)
 			if [ -f /$IDS_RUNDIR/$NAME.oneshot ]; then



More information about the Debian-init-diversity mailing list