Package: hpsockd
Version: 0.17+b1
Followup-For: Bug #481348

Dear Maintainer,

hpsockd enter daemon status by itself therefor start-stop-daemon can not create
the proper pid file, which causes the script fail to stop daemon.

Invoke start-stop-daemon with --name instead of --pidfile fix the problem.



-- System Information:
Debian Release: 7.7
  APT prefers stable
  APT policy: (900, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14.24 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash



>From 06e19c61607ec1de5df40746e3306ded093ecf45 Mon Sep 17 00:00:00 2001
From: Chen Wei <weichen...@icloud.com>
Date: Sat, 10 Jan 2015 16:12:35 +0800
Subject: [PATCH] fix Bug #481348, init script not stop daemon

---
 debian/init.d |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/debian/init.d b/debian/init.d
index 72f7e90..f0417a5 100755
--- a/debian/init.d
+++ b/debian/init.d
@@ -13,14 +13,24 @@
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/sbin/hpsockd
 NAME=hpsockd
+WORKDIR=/var/cache/$NAME
 DESC="HP SOCKS daemon"
 
 test -f $DAEMON || exit 0
 
 set -e
 
+check_hpsockd_dir()
+{
+    if [ ! -d $WORKDIR ]; then
+        mkdir -m 755 $WORKDIR
+        chown nobody:root $WORKDIR
+    fi
+}
+
 case "$1" in
   start)
+    check_hpsockd_dir
        if [ -f /etc/hpsockd.conf ]; then
                echo -n "Starting $DESC: "
                start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
@@ -32,8 +42,7 @@ case "$1" in
        ;;
   stop)
        echo -n "Stopping $DESC: "
-       start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
-               --exec $DAEMON
+       start-stop-daemon --stop --quiet --name $NAME
        echo "$NAME."
        ;;
   reload|force-reload)
@@ -42,8 +51,7 @@ case "$1" in
   ;;
   restart)
        echo -n "Restarting $DESC: "
-       start-stop-daemon --stop --quiet --pidfile \
-               /var/run/$NAME.pid --exec $DAEMON
+       start-stop-daemon --stop --quiet --name $NAME
        sleep 1
        start-stop-daemon --start --quiet --pidfile \
                /var/run/$NAME.pid --exec $DAEMON
-- 
1.7.10.4


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to