Permalink
Browse files

Fix for COUCHDB-1449 stopped status returned before couchdb process e…

…xits.
  • Loading branch information...
1 parent f36232c commit 15c1a97e42c5bafad6f5fa83d753d3a7cf64d6d7 @wendall911 wendall911 committed with janl Mar 11, 2013
Showing with 12 additions and 4 deletions.
  1. +12 −4 bin/couchdb.tpl.in
View
@@ -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

1 comment on commit 15c1a97

I am running Ubuntu 12.04 64-bit and this change does not work for me. The parent script is still running after a "stop" command is given, which starts up CouchDB again. Adding back in lines 292-294 solves this problem.

Please sign in to comment.