From b9ae855347369ce33e804a35bae1275c378e015a Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Mon, 26 Oct 2009 11:09:47 +0100 Subject: [PATCH] Create pidfile directory --- debian/init | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/debian/init b/debian/init index 5caf124..420da80 100755 --- a/debian/init +++ b/debian/init @@ -21,6 +21,8 @@ DAEMON=/usr/sbin/$NAME DAEMON_ARGS="-c /etc/yubikeyd.conf" PIDFILE=/var/run/yubikeyd/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME +U=$(grep ^user= /etc/yubikeyd.conf| cut -d= -f 2) +G=$(grep ^group= /etc/yubikeyd.conf| cut -d= -f 2) # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 @@ -40,13 +42,16 @@ SCRIPTNAME=/etc/init.d/$NAME # do_start() { - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ - $DAEMON_ARGS \ - || return 2 + + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + mkdir -p "$(dirname $PIDFILE)" + chown "$U:$G" "$(dirname $PIDFILE)" + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 } # -- 2.39.5