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.

1.4_CheckBlock.sh 879B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. function getBlockNumber() {
  3. jsonURL=$1
  4. status=`curl -H Content-Type:application/json -d '{"jsonrpc": "2.0", "method": "eth_blockNumber", "id": 1}' -s $jsonURL -m 1`
  5. # jq -r 로 "" 스트립
  6. ID=`echo $status | jq -r '.["result"]'`
  7. if [ "$status" == "null" ] || [ "$status" == 0 ]; then
  8. echo "get blocknumber failed"
  9. else
  10. echo $ID
  11. printf "블럭 넘버 = %d\n" $ID
  12. # 다른방식으로 hex값 변환
  13. # STRIPED=$(echo $ID |sed -e $'s/0x//g' )
  14. # HEX=$((16#$STRIPED))
  15. # echo $HEX
  16. fi
  17. }
  18. kubectl get pods -n besu besu-node-validator-1-0 -o wide
  19. echo "Validator1"
  20. getBlockNumber "http://127.0.0.1:21001"
  21. echo "Validator2"
  22. getBlockNumber "http://127.0.0.1:21002"
  23. echo "Validator3"
  24. getBlockNumber "http://127.0.0.1:21003"
  25. echo "Validator4"
  26. getBlockNumber "http://127.0.0.1:21004"