From 6ceb9a680e009af48e5334f3313e53d8a72e1b00 Mon Sep 17 00:00:00 2001 From: Oliver Schmidhauser Date: Tue, 13 Aug 2019 13:20:38 +0200 Subject: [PATCH] Create run dircetory on start If the run directory doesn't exist (on a brand new installation or if it has been deleted) starting the service may fail and under certain circumstances causes many instances of runsvdir to be started. --- service-daemon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service-daemon b/service-daemon index 8d96a6e..75b9a84 100755 --- a/service-daemon +++ b/service-daemon @@ -2,6 +2,7 @@ set -e start(){ + mkdir -p $PIDDIR start-stop-daemon -S -b -m -p $PIDFILE -x $DAEMON -- $DAEMON_OPTS } stop(){ @@ -14,7 +15,8 @@ stop(){ } # Must be a valid filename NAME=service-daemon -PIDFILE=$PREFIX/var/run/$NAME.pid +PIDDIR=$PREFIX/var/run +PIDFILE=$PIDDIR/$NAME.pid #This is the command to be run, give the full pathname DAEMON=$PREFIX/bin/applets/runsvdir DAEMON_OPTS="$SVDIR"