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