From bd0eadc16e35fb1f4f17cbbe74840acd4344ce2a Mon Sep 17 00:00:00 2001 From: David Escalona Date: Wed, 28 Sep 2022 13:01:12 +0200 Subject: [PATCH] meta-digi-dey: dey-examples: fix start/stop script of "connectcore-demo-example" service The start/stop script of the service was using "killproc" and "pidofproc" functions from "/etc/init.d/functions" to find the process PID. These functions rely on "pidof", which does not work very well with Python scripts. Instead, use "pkill" and "pgrep" which allow to search the executable in the full command line to retrieve the correct PID with the -f modifier. Signed-off-by: David Escalona --- .../connectcore-demo-example/connectcore-demo-example-init | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/connectcore-demo-example-init b/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/connectcore-demo-example-init index 4c802a91d..3049cafe6 100644 --- a/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/connectcore-demo-example-init +++ b/meta-digi-dey/recipes-digi/dey-examples/connectcore-demo-example/connectcore-demo-example-init @@ -13,17 +13,14 @@ # #=============================================================================== -# Source function library -. /etc/init.d/functions - readonly DEMOSERVER_BINARY="/srv/www/demoserver.py" readonly STOP_TIMEOUT="5" stop_process() { # try to stop gracefully - killproc "${1}" >/dev/null 2>&1 + pkill -f "${1}" >/dev/null 2>&1 for i in $(seq ${STOP_TIMEOUT}); do - pid=$(pidofproc "${1}") || break + pid=$(pgrep -f "${1}") || break if [ "${i}" -eq ${STOP_TIMEOUT} ]; then kill -KILL "${pid}" >/dev/null 2>&1 fi