#!/bin/sh

retry_count_max=20
sleeptime_between_retry=3

echo "Checking sync_gateway processes"
retry_count=0
while true; do
    result=`curl http://localhost:4985/db?n=1`
    if [ -z "$result" ]; then
        echo "Sync-gateway process is not running yet.  Retrying."
        retry_count=`expr $retry_count + 1`
        if [ $retry_count -gt $retry_count_max ]; then
          echo "Sync-gateway process is not running yet after $retry_count_max retries.   Giving up."
          exit 9
        fi
        sleep $sleeptime_between_retry
    else
        echo "gateway_${index} sync_gateway is running"
        break
    fi
done

#!/bin/sh

retry_count_max=40
sleeptime_between_retry=3
myip=`ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`

echo "Checking sync_gateway processes"
retry_count=0
while true; do
    result=`curl http://localhost:4985/db?n=1`
    if [ -z "$result" ]; then
        echo "Sync-gateway process is not running yet.  Retrying."
        retry_count=`expr $retry_count + 1`
        if [ $retry_count -gt $retry_count_max ]; then
          echo "Sync-gateway process is not running on ${myip} yet after $retry_count_max retries.   Giving up."
          exit 9
        fi
        sleep $sleeptime_between_retry
    else
        echo "gateway_${index} sync_gateway is running"
        break
    fi
done

Add ip address to the retry message and double the maximum retry counts
Add ip address to the retry message and double the maximum retry counts

Change-Id: Icf7b28a8eff9c1c4b06da63cbe546aba68bab21a
Reviewed-on: http://review.couchbase.org/37053
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Li Yang <b23b5fb240ae87c71e4667a21ecd9f27d5443975@gmail.com>
