From 7b056cd78304ac23d94bb3eefae0af8073e9581c Mon Sep 17 00:00:00 2001 From: Yalu Zhang Date: Wed, 26 Apr 2023 16:19:33 +0200 Subject: [PATCH] dectmngr: fix a bug in etc/init.d/dectmngr which kills the script itself This is a regression caused by the below commit. The command "killall dectmngr" tries to kill both the service /usr/sbin/dectmngr and the init-script /etc/init.d/dectmngr. This is wrong. The fix is to kill /usr/sbin/dectmngr only. commit 501193da987d1d99cc8401ed808982e3416f1f52 Author: Yalu Zhang Date: Tue May 11 11:15:35 2021 +0200 Rename etc/init.d/dect to etc/init.d/dectmngr --- dectmngr/files/etc/init.d/dectmngr | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dectmngr/files/etc/init.d/dectmngr b/dectmngr/files/etc/init.d/dectmngr index d539f56aa..082d0af0f 100755 --- a/dectmngr/files/etc/init.d/dectmngr +++ b/dectmngr/files/etc/init.d/dectmngr @@ -6,7 +6,6 @@ START=70 STOP=12 USE_PROCD=1 -NAME=dectmngr PROG=/usr/sbin/dectmngr LOG_PATH=/var/log/dectmngr DB_PATH=/etc/dect @@ -16,11 +15,13 @@ DECT_GPIO="$(gpiofind DCX81_RSTN | cut -d ' ' -f 2 2>/dev/null)" # Ask dectmngr to exit nicely and wait for it to clean up, which is a slow process. stop_and_wait_dectmngr() { - pidof $NAME && killall -q $NAME + dect_pid=$(pidof $PROG) + [ -n "$dect_pid" ] && kill $dect_pid - pidof $NAME && sleep 2 # wait for the process to stop gracefully - while pidof $NAME; do - killall -q -9 $NAME + pidof $PROG > /dev/null 2>&1 && sleep 2 # wait for the process to stop gracefully + while pidof $PROG > /dev/null 2>&1; do + dect_pid=$(pidof $PROG) + [ -n "$dect_pid" ] && kill -9 $dect_pid sleep 1 done }