couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [1/2] git commit: Fix for COUCHDB-1449 stopped status returned before couchdb process exits.
Date Mon, 18 Mar 2013 16:12:32 GMT
Fix for COUCHDB-1449 stopped status returned before couchdb process exits.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/15c1a97e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/15c1a97e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/15c1a97e

Branch: refs/heads/master
Commit: 15c1a97e42c5bafad6f5fa83d753d3a7cf64d6d7
Parents: f36232c
Author: Wendall Cada <wendallc@83864.com>
Authored: Mon Mar 11 12:05:34 2013 -0700
Committer: Jan Lehnardt <jan@apache.org>
Committed: Mon Mar 18 17:12:08 2013 +0100

----------------------------------------------------------------------
 bin/couchdb.tpl.in |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/15c1a97e/bin/couchdb.tpl.in
----------------------------------------------------------------------
diff --git a/bin/couchdb.tpl.in b/bin/couchdb.tpl.in
index 8b2581a..ff06007 100644
--- a/bin/couchdb.tpl.in
+++ b/bin/couchdb.tpl.in
@@ -288,12 +288,20 @@ EOF
 
 stop_couchdb () {
     PID=`_get_pid`
+    STOP_TIMEOUT=60
     if test -n "$PID"; then
-        if test "$1" = "false"; then
-            echo > $PID_FILE
-        fi
         if kill -0 $PID 2> /dev/null; then
-            if kill -1 $PID 2> /dev/null; then
+            if kill -TERM $PID 2> /dev/null; then
+                count=0
+                while kill -0 $PID 2> /dev/null; do
+                    if [ $count -ge $STOP_TIMEOUT ]; then
+                        echo "Apache CouchDB failed to shutdown."
+                        return $SCRIPT_ERROR
+                    else
+                        count=$[count+1]
+                        sleep 1
+                    fi
+                done
                 if test "$1" = "false"; then
                     echo "Apache CouchDB has been shutdown."
                 else


Mime
View raw message