github.com/adnan-c/fabric_e2e_couchdb@v0.6.1-preview.0.20170228180935-21ce6b23cf91/bddtests/scripts/start-peer.sh (about)

     1  #!/bin/sh
     2  
     3  SCRIPT_DIR=$(dirname $0)
     4  MEMBERSHIP_IP=$(cat /etc/hosts | grep membersrvc | head -n 1 | cut -f1)
     5  TIMEOUT=10
     6  
     7  if [ -n "$MEMBERSHIP_IP" ]; then
     8      echo "membersrvc detected, waiting for it before starting with a $TIMEOUT second timout"
     9      "$SCRIPT_DIR"/wait-for-it.sh -t "$TIMEOUT" "$MEMBERSHIP_IP":7054
    10  
    11      if [ $? -ne 0 ]; then
    12          echo "Failed to contact membersrvc within $TIMEOUT seconds"
    13          exit 1
    14      fi
    15  else
    16      echo "No membersrvc to wait for, starting immediately"
    17  fi
    18  
    19  exec peer node start
    20