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 501193da98
Author: Yalu Zhang <yalu.zhang@iopsys.eu>
Date:   Tue May 11 11:15:35 2021 +0200

    Rename etc/init.d/dect to etc/init.d/dectmngr
This commit is contained in:
Yalu Zhang 2023-04-26 16:19:33 +02:00
parent 218d613ed1
commit 7b056cd783

View file

@ -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
}