From e085c4113326052be4f43007ba61de76139b8dd6 Mon Sep 17 00:00:00 2001 From: reubenmiller Date: Sat, 2 Nov 2024 13:29:08 +0100 Subject: [PATCH] fix(sysvinit): improve pidfile location fallback --- services/sysvinit-yocto/service-background.template | 5 +++++ services/sysvinit/service-start-stop-daemon.template | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/services/sysvinit-yocto/service-background.template b/services/sysvinit-yocto/service-background.template index f41b83f..c960c41 100644 --- a/services/sysvinit-yocto/service-background.template +++ b/services/sysvinit-yocto/service-background.template @@ -16,6 +16,11 @@ DAEMON_ARGS="$COMMAND_ARGS" name="$NAME" PIDFILE=/run/lock/$name.lock +if [ -d /run/lock ]; then + PIDFILE=/run/lock/$name.lock +else + PIDFILE=/var/run/$name.lock +fi stdout_log="/var/log/$name.log" stderr_log="/var/log/$name.err" diff --git a/services/sysvinit/service-start-stop-daemon.template b/services/sysvinit/service-start-stop-daemon.template index 71a79ec..f579b23 100644 --- a/services/sysvinit/service-start-stop-daemon.template +++ b/services/sysvinit/service-start-stop-daemon.template @@ -37,6 +37,11 @@ export TEDGE_RUN_LOCK_FILES="false" DAEMON=$COMMAND PIDFILE=/run/lock/$NAME.lock +if [ -d /run/lock ]; then + PIDFILE=/run/lock/$NAME.lock +else + PIDFILE=/var/run/$NAME.lock +fi STOP_RETRY_SCHEDULE='TERM/30/KILL/1'