summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorWendall Cada <wendallc@83864.com>2013-03-11 12:05:34 -0700
committerJan Lehnardt <jan@apache.org>2013-03-18 17:12:08 +0100
commit15c1a97e42c5bafad6f5fa83d753d3a7cf64d6d7 (patch)
tree35b3aa1448f930c47c80a54bfbe8177dcfb1ce52 /bin
parentf36232c87b0dffd0c145938685ea28f042b7e47b (diff)
downloadcouchdb-15c1a97e42c5bafad6f5fa83d753d3a7cf64d6d7.tar.gz
Fix for COUCHDB-1449 stopped status returned before couchdb process exits.
Diffstat (limited to 'bin')
-rw-r--r--bin/couchdb.tpl.in16
1 files changed, 12 insertions, 4 deletions
diff --git a/bin/couchdb.tpl.in b/bin/couchdb.tpl.in
index 8b2581a66..ff0600746 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