github.com/braveheart12/insolar-09-08-19@v0.8.7/scripts/insolard/check_status.sh (about)

     1  #!/usr/bin/env bash
     2  set -o pipefail
     3  
     4  confs=$( dirname $0 )"/configs/generated_configs/discoverynodes"
     5  api_ports=$( grep -A 1 "apirunner" $confs/insolar_*.yaml  | grep address  |  grep -o ":\d\+" | grep -o "\d\+" | tr '\n' ' ' )
     6  grep_exit=$?
     7  if [[ $grep_exit -ne 0 ]]; then
     8      exit 1
     9  fi
    10  
    11  exit_code=0
    12  for port in $api_ports
    13  do
    14      echo "Port $port. Status: "
    15      status=$(curl --header "Content-Type:application/json"  --data '{ "jsonrpc": "2.0", "method": "status.Get","id": "" }'  "localhost:$port/api/rpc" 2>/dev/null |  python -m json.tool | grep -i AdditionalNodeState)
    16      echo "    $status"
    17      echo
    18      if [[ $status != *"NodeReady"* ]]; then
    19          exit_code=1
    20      fi
    21  done
    22  exit $exit_code