[Pkg-erlang-commits] r1231 - in couchdb/branches/0.8.0-2+lenny1/debian: . patches
sbisbee-guest at alioth.debian.org
sbisbee-guest at alioth.debian.org
Wed Mar 24 19:36:09 UTC 2010
Author: sbisbee-guest
Date: 2010-03-24 19:36:08 +0000 (Wed, 24 Mar 2010)
New Revision: 1231
Added:
couchdb/branches/0.8.0-2+lenny1/debian/patches/init.patch
Modified:
couchdb/branches/0.8.0-2+lenny1/debian/changelog
couchdb/branches/0.8.0-2+lenny1/debian/control
Log:
backporting 0.10.1-2 init.patch stopping power to 0.8.0-2+lenny1
Modified: couchdb/branches/0.8.0-2+lenny1/debian/changelog
===================================================================
--- couchdb/branches/0.8.0-2+lenny1/debian/changelog 2010-03-24 17:04:31 UTC (rev 1230)
+++ couchdb/branches/0.8.0-2+lenny1/debian/changelog 2010-03-24 19:36:08 UTC (rev 1231)
@@ -1,3 +1,10 @@
+couchdb (0.8.0-2+lenny1) stable; urgency=low
+
+ * Backporting init.patch changes from 0.10.0-2 that are related to the clean
+ stopping of couchdb. Introduces dependencies on procps and mawk.
+
+ -- Sam Bisbee <sbisbee at computervip.com> Wed, 24 Mar 2010 15:15:56 -0400
+
couchdb (0.8.0-2) unstable; urgency=low
* Added debian/README.source for upstream source information.
Modified: couchdb/branches/0.8.0-2+lenny1/debian/control
===================================================================
--- couchdb/branches/0.8.0-2+lenny1/debian/control 2010-03-24 17:04:31 UTC (rev 1230)
+++ couchdb/branches/0.8.0-2+lenny1/debian/control 2010-03-24 19:36:08 UTC (rev 1231)
@@ -14,7 +14,7 @@
Package: couchdb
Architecture: any
Depends: ${shlibs:Depends}, ${erlang-abi:Depends}, ${erlang-nox:Depends},
- adduser, lsb-base, mime-support
+ adduser, lsb-base, mime-support, procps, mawk
Description: a RESTful document oriented database
Apache CouchDB is a distributed document database system with bi-directional
replication. It makes it simple to build collaborative applications that can
Added: couchdb/branches/0.8.0-2+lenny1/debian/patches/init.patch
===================================================================
--- couchdb/branches/0.8.0-2+lenny1/debian/patches/init.patch (rev 0)
+++ couchdb/branches/0.8.0-2+lenny1/debian/patches/init.patch 2010-03-24 19:36:08 UTC (rev 1231)
@@ -0,0 +1,68 @@
+--- couchdb-0.8.0/etc/init/couchdb.tpl.in 2008-06-16 18:48:21.000000000 -0400
++++ couchdb-0.8.0.new/etc/init/couchdb.tpl.in 2010-03-24 15:15:28.000000000 -0400
+@@ -34,6 +34,10 @@
+ CONFIGURATION_FILE=%sysconfdir%/default/couchdb
+ LSB_LIBRARY=/lib/lsb/init-functions
+
++# Grace time in seconds to give the beam process to stop when we're running the
++# stop target. Will end before grace time ends if the process ends sooner.
++STOP_GRACE_TIME=5
++
+ if test ! -x $COUCHDB; then
+ exit $SCRIPT_ERROR
+ fi
+@@ -102,23 +106,48 @@
+ stop_couchdb () {
+ # Stop the running Apache CouchDB process.
+
++ if [ ! -r "$COUCHDB_PID_FILE" ]
++ then
++ #exists, but can't read it
++ [ -f "$COUCHDB_PID_FILE" ] && return $SCRIPT_ERROR
++
++ #doesn't exist, so assume couchdb is already stopped
++ return $SCRIPT_OK
++ fi
++
++ pid=`cat $COUCHDB_PID_FILE`
++ [ -z "$pid" ] && return $SCRIPT_OK
++
+ command="$COUCHDB -d"
+ if test -n "$COUCHDB_PID_FILE"; then
+ command="$command -p $COUCHDB_PID_FILE"
+ fi
++
++ # 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}'`
++ [ -n "$heart_pid" ] && heart_pid=",$heart_pid" #for `ps` call formatting
++
+ if test -n "$COUCHDB_USER"; then
+- if su $COUCHDB_USER -c "$command" > /dev/null; then
+- return $SCRIPT_OK
+- else
++ if ! su $COUCHDB_USER -c "$command" > /dev/null; then
+ return $SCRIPT_ERROR
+ fi
+ else
+- if $command > /dev/null; then
+- return $SCRIPT_OK
+- else
++ if ! $command > /dev/null; then
+ return $SCRIPT_ERROR
+ fi
+ fi
++
++ i=0
++ while ps -p $pid$heart_pid --ppid $pid$heart_pid > /dev/null
++ do
++ [ $i -ge $STOP_GRACE_TIME ] && return $SCRIPT_ERROR
++
++ sleep 1
++ i=`expr $i + 1`
++ done
++
++ return $SCRIPT_OK
+ }
+
+ display_status () {
More information about the Pkg-erlang-commits
mailing list