tags 490985 + patch
block 490985 by 491042
thanks

On 2008-07-15 23:23 +0200, Sven Joachim wrote:

> I tried to change portmap's init script to use "start-stop-daemon
> --pidfile", but without success.  The problem is that portmap starts
> before mountnfs-bootclean.sh which deletes its pidfile. :-(

I've filed #491042 against the initscripts package.  When that bug is
fixed, the following patch for the portmap initscript works for me:

--8<---------------cut here---------------start------------->8---
--- portmap~    2008-07-15 22:03:54.000000000 +0200
+++ portmap     2008-07-16 09:57:06.000000000 +0200
@@ -30,13 +30,13 @@
 case "$1" in
     start)
        log_begin_msg "Starting portmap daemon..."
-       pid=`pidof portmap`
-       if [ -n "$pid" ] ; then
-             log_begin_msg "Already running."
-             log_end_msg 0
-             exit 0
+       if start-stop-daemon --stop --quiet --pidfile /var/run/portmap.pid \
+              --signal 0 --exec /sbin/portmap > /dev/null; then
+          log_success_msg " already running."
+          exit 0
        fi
-       start-stop-daemon --start --quiet --oknodo --exec /sbin/portmap -- 
$OPTIONS
+       start-stop-daemon --start --quiet --pidfile /var/run/portmap.pid \
+           --exec /sbin/portmap -- $OPTIONS
        log_end_msg $?
 
        if [ -f /var/run/portmap.upgrade-state ]; then
@@ -61,7 +61,7 @@
     stop)
        log_begin_msg "Stopping portmap daemon..."
        pmap_dump >/var/run/portmap.state
-       start-stop-daemon --stop --quiet --oknodo --exec /sbin/portmap
+       start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/portmap.pid
        log_end_msg $?
        ;;
     force-reload)
--8<---------------cut here---------------end--------------->8---

I also tested an unclean shutdown that does not delete
/var/run/portmap.pid, and portmap still started correctly on the next
boot.

A fixed portmap package will have to conflict with
initscripts (<= 2.86.ds1-59) since their mountnfs-bootclean.sh
deletes portmap's pid file.

Cheers,
       Sven



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to