You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
815 B

  1. #!/bin/bash
  2. ITERATIONS=$1
  3. SLEEP=$2
  4. NUMBLOCKS=$3
  5. NODEADDR=$4
  6. if [ -z "$1" ]; then
  7. echo "Need to input number of iterations to run..."
  8. exit 1
  9. fi
  10. if [ -z "$2" ]; then
  11. echo "Need to input number of seconds to sleep between iterations"
  12. exit 1
  13. fi
  14. if [ -z "$3" ]; then
  15. echo "Need to input block height to declare completion..."
  16. exit 1
  17. fi
  18. if [ -z "$4" ]; then
  19. echo "Need to input node address to poll..."
  20. exit 1
  21. fi
  22. I=0
  23. while [ ${I} -lt "$ITERATIONS" ]; do
  24. var=$(curl -s "$NODEADDR:26657/status" | jq -r ".result.sync_info.latest_block_height")
  25. echo "Number of Blocks: ${var}"
  26. if [ ! -z "${var}" ] && [ "${var}" -gt "${NUMBLOCKS}" ]; then
  27. echo "Number of blocks reached, exiting success..."
  28. exit 0
  29. fi
  30. I=$((I+1))
  31. sleep "$SLEEP"
  32. done
  33. echo "Timeout reached, exiting failure..."
  34. exit 1