[Pkg-erlang-commits] r1212 - couchdb/trunk/debian/patches
sbisbee-guest at alioth.debian.org
sbisbee-guest at alioth.debian.org
Tue Mar 9 03:47:37 UTC 2010
Author: sbisbee-guest
Date: 2010-03-09 03:47:37 +0000 (Tue, 09 Mar 2010)
New Revision: 1212
Modified:
couchdb/trunk/debian/patches/init.patch
Log:
fixing init case where pid run file isn't there
Modified: couchdb/trunk/debian/patches/init.patch
===================================================================
--- couchdb/trunk/debian/patches/init.patch 2010-03-08 21:42:47 UTC (rev 1211)
+++ couchdb/trunk/debian/patches/init.patch 2010-03-09 03:47:37 UTC (rev 1212)
@@ -1,5 +1,5 @@
--- couchdb-0.10.1/etc/init/couchdb.tpl.in 2009-07-14 16:21:39.000000000 -0400
-+++ couchdb-0.10.1.new/etc/init/couchdb.tpl.in 2010-02-28 01:51:30.000000000 -0500
++++ couchdb-0.10.1.new/etc/init/couchdb.tpl.in 2010-03-08 22:18:35.000000000 -0500
@@ -33,8 +33,12 @@
RUN_DIR=%localstaterundir%
LSB_LIBRARY=/lib/lsb/init-functions
@@ -22,14 +22,29 @@
if test -n "$COUCHDB_USER"; then
chown $COUCHDB_USER "$RUN_DIR"
if su $COUCHDB_USER -c "$command" > /dev/null; then
-@@ -100,19 +105,35 @@
+@@ -96,23 +101,50 @@
+ stop_couchdb () {
+ # Stop the running Apache CouchDB process.
+
++ pidFile="$RUN_DIR/couchdb.pid"
++ if [ ! -r "$pidFile" ]
++ then
++ #exists, but can't read it
++ [ -f "$pidFile" ] && return $SCRIPT_ERROR
++
++ #doesn't exist, so assume couchdb is already stopped
++ return $SCRIPT_OK
++ fi
++
++ pid=`cat $pidFile`
++ unset $pidFile
++ [ -z "$pid" ] && return $SCRIPT_OK
++
+ command="$COUCHDB -d"
if test -n "$COUCHDB_OPTIONS"; then
command="$command $COUCHDB_OPTIONS"
fi
+
-+ pid=`cat $RUN_DIR/couchdb.pid`
-+ [ -z "$pid" ] && return $SCRIPT_OK
-+
+ # We need `heart`'s pid because its ppid is set to 1 when the beam proc
+ # ends, thereby hiding itself from our `ps` check bellow.
+ heart_pid=`ps -f --ppid $pid | grep "heart -pid $pid " | awk '{print $2}'`
More information about the Pkg-erlang-commits
mailing list