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 }