From: Michael Olson Date: Fri, 15 Feb 2008 04:35:18 +0000 (+0000) Subject: init scripts: Fix bug with writing PID files X-Git-Tag: release_2010-11-19~61 X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/commitdiff_plain/a78867ddc7e61af8e004f51102a802c583ffbecd init scripts: Fix bug with writing PID files --- diff --git a/scripts/domtool-server b/scripts/domtool-server index da7282a..6078c60 100755 --- a/scripts/domtool-server +++ b/scripts/domtool-server @@ -1,9 +1,10 @@ #!/usr/bin/pagsh.openafs -# This script should go in /etc/init.d/ on Debian Linux systems running Domtool dispatchers. +# This script should go in /etc/init.d/ on Debian Linux systems +# running Domtool dispatchers. SELF=$(cd $(dirname $0); pwd -P)/$(basename $0) -PIDFILE="/var/run/k5start-domtool-server.pid" +PIDFILE="/var/run/domtool/k5start-server.pid" set -e @@ -13,6 +14,12 @@ case $1 in if sudo -u domtool domtool-admin-sudo ping; then echo "...already running." else + PIDDIR=$(dirname "$PIDFILE") + if test ! -d "$PIDDIR"; then + mkdir -m 0755 $PIDDIR + chown domtool:domtool $PIDDIR + fi + start-stop-daemon --start --pidfile $PIDFILE \ -c domtool:domtool \ --exec /usr/bin/k5start -- -U -b \ diff --git a/scripts/domtool-slave b/scripts/domtool-slave index 2653813..5392bea 100755 --- a/scripts/domtool-slave +++ b/scripts/domtool-slave @@ -1,9 +1,10 @@ #!/usr/bin/pagsh.openafs -# This script should go in /etc/init.d/ on Debian Linux systems running Domtool slaves. +# This script should go in /etc/init.d/ on Debian Linux systems +# running Domtool slaves. SELF=$(cd $(dirname $0); pwd -P)/$(basename $0) -PIDFILE="/var/run/k5start-domtool-slave.pid" +PIDFILE="/var/run/domtool/k5start-slave.pid" set -e @@ -13,6 +14,12 @@ case $1 in if sudo -u domtool domtool-admin-sudo slave-ping; then echo "...already running." else + PIDDIR=$(dirname "$PIDFILE") + if test ! -d "$PIDDIR"; then + mkdir -m 0755 $PIDDIR + chown domtool:domtool $PIDDIR + fi + start-stop-daemon --start --pidfile $PIDFILE \ -c domtool:domtool \ --exec /usr/bin/k5start -- -U -b \