Sfoglia il codice sorgente

Resolves: 245894
Summary: Make init script verify that existing pidfile refers to a ns-slapd process.

Nathan Kinder 17 anni fa
parent
commit
bfe0c19a84
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 7 2
      wrappers/initscript.in

+ 7 - 2
wrappers/initscript.in

@@ -138,7 +138,10 @@ start() {
             server_running=0
             if [ -f $pidfile ]; then
                 pid=`cat $pidfile`
-                if kill -0 $pid > /dev/null 2>&1 ; then
+                instlockfile="@localstatedir@/lock/@package_name@/slapd-$instance/server/$pid"
+                if kill -0 $pid && \
+                 [ $(awk '{print $2}' /proc/$pid/stat) = "(ns-slapd)" ] \
+                 > /dev/null 2>&1 ; then
                     echo_n " already running"
                     success; echo
                     successes=`expr $successes + 1`
@@ -146,7 +149,9 @@ start() {
                 else
                     echo " not running, but pid file exists"
                     echo_n "    $instance... attempting to start anyway"
-                    rm -f $pidfile
+                    # Clean up the instance lockfile since we know the pid.  The
+                    # pidfiles will get cleaned up below.
+                    rm -f $instlockfile
                 fi
             fi
             server_started=0