[Debian-ha-commits] [booth] 02/04: Fix init script to work with boothd's pid file format.

Christoph Berg myon at debian.org
Wed Mar 30 18:12:25 UTC 2016


This is an automated email from the git hooks/post-receive script.

myon pushed a commit to branch master
in repository booth.

commit 1b0a9dfbdae01de5d88eb2f871a30e639adfe9ec
Author: Christoph Berg <myon at debian.org>
Date:   Wed Mar 30 20:03:48 2016 +0200

    Fix init script to work with boothd's pid file format.
---
 debian/booth.init | 20 +++++++-------------
 debian/changelog  |  1 +
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/debian/booth.init b/debian/booth.init
index 7c065ca..e8807bb 100755
--- a/debian/booth.init
+++ b/debian/booth.init
@@ -30,7 +30,7 @@ test -f $DAEMON || exit 0
 # Evaluate the config for the Debian scripts
 RUN_ARBITRATOR=no
 PIDFILE=/var/run/$NAME.pid
-OPTIONS=""
+OPTIONS="daemon -c /etc/booth/booth.conf"
 
 if [ -r /etc/default/booth ]; then
   . /etc/default/booth
@@ -48,10 +48,6 @@ fi
 #
 do_start()
 {
-        if [ "$RUN_ARBITRATOR" != "yes" ]; then
-                return 0
-        fi
-
         # Return
         #   0 if daemon has been started
         #   1 if daemon was already running
@@ -72,24 +68,22 @@ do_start()
 #
 do_stop()
 {
-        if [ "$RUN_ARBITRATOR" != "yes" ]; then
-                return 0
-        fi
-
         # Return
         #   0 if daemon has been stopped
         #   1 if daemon was already stopped
         #   2 if daemon could not be stopped
         #   other if a failure occurred
+        PID=$(perl -lne 'print $1 if /booth_pid=(\d+)/' /var/run/booth/booth.pid 2>/dev/null)
+        [ "$PID" ] || return 1
         start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
-                --pidfile $PIDFILE --name $NAME
+                --pid $PID --name $NAME
         return "$?"
 }
 
 case "$1" in
   start)
         if [ "$RUN_ARBITRATOR" != "yes" ]; then
-                log_warning_msg "To run $DESC, please set RUN_ARBITRATOR to 'yes' in /etc/default/$NAME "
+                log_warning_msg "To run $DESC, please set RUN_ARBITRATOR to 'yes' in /etc/default/booth"
                 log_end_msg 0
                 exit 0
         fi
@@ -102,7 +96,7 @@ case "$1" in
         ;;
   stop)
         if [ "$RUN_ARBITRATOR" != "yes" ]; then
-                log_warning_msg "To run $DESC, please set RUN_ARBITRATOR to 'yes' in /etc/default/$NAME "
+                log_warning_msg "To run $DESC, please set RUN_ARBITRATOR to 'yes' in /etc/default/booth"
                 log_end_msg 0
                 exit 0
         fi
@@ -132,7 +126,7 @@ case "$1" in
 
   restart|force-reload)
         if [ $RUN_ARBITRATOR != "yes" ]; then
-                log_warning_msg "To run $DESC, please set RUN_ARBITRATOR to 'yes' in /etc/default/$NAME "
+                log_warning_msg "To run $DESC, please set RUN_ARBITRATOR to 'yes' in /etc/default/booth"
                 exit 0
         fi
         log_daemon_msg "Restarting $DESC" "$NAME"
diff --git a/debian/changelog b/debian/changelog
index a4e969a..8019023 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ booth (1.0-1) unstable; urgency=low
   [ Christoph Berg ]
   * Update package descriptions. Closes: #819575.
   * Architecture: any.
+  * Fix init script to work with boothd's pid file format.
 
  -- Adrian Vondendriesch <adrian.vondendriesch at credativ.de>  Mon, 28 Mar 2016 18:14:21 +0200
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/booth.git



More information about the Debian-HA-Commits mailing list