From d4da4c3485fc971b90dbb4af319a7cfbe9063e09 Mon Sep 17 00:00:00 2001 From: wanwiset25 Date: Fri, 13 Sep 2024 14:23:32 +0400 Subject: [PATCH] don't use jq as it's not installed by default --- subnet/deployment-generator/scripts/check-mining.sh | 4 ++-- subnet/deployment-generator/scripts/check-peer.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/subnet/deployment-generator/scripts/check-mining.sh b/subnet/deployment-generator/scripts/check-mining.sh index 1f9864e..fd7345f 100755 --- a/subnet/deployment-generator/scripts/check-mining.sh +++ b/subnet/deployment-generator/scripts/check-mining.sh @@ -5,7 +5,7 @@ resp=$(curl -s --location 'http://localhost:8545' \ --header 'Content-Type: application/json' \ --data '{"jsonrpc":"2.0","method":"XDPoS_getV2BlockByNumber","params":["latest"],"id":1}') -num=$(echo $resp | jq -r .result.Number) +num=$(echo $resp | grep -o '"Number":[0-9]*' | cut -d':' -f2 | tr -d ' ') echo $num if [[ $num == "null" ]] || [[ $num == "" ]]; then @@ -19,7 +19,7 @@ else resp=$(curl -s --location 'http://localhost:8545' \ --header 'Content-Type: application/json' \ --data '{"jsonrpc":"2.0","method":"XDPoS_getV2BlockByNumber","params":["latest"],"id":1}') - nextnum=$(echo $resp | jq -r .result.Number) + nextnum=$(echo $resp | grep -o '"Number":[0-9]*' | cut -d':' -f2 | tr -d ' ') echo $nextnum done fi diff --git a/subnet/deployment-generator/scripts/check-peer.sh b/subnet/deployment-generator/scripts/check-peer.sh index fd2aa74..1366183 100755 --- a/subnet/deployment-generator/scripts/check-peer.sh +++ b/subnet/deployment-generator/scripts/check-peer.sh @@ -4,6 +4,6 @@ resp=$(curl -s --location "http://localhost:8545" \ --header 'Content-Type: application/json' \ --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}') echo $resp -num_peers=$(echo $resp | jq -r .result) +num_peers=$(echo $resp | grep -o '"result":"[^"]*"' | cut -d'"' -f4) num_peers_dec=$(printf "%d\n" $num_peers) echo "peers: $num_peers_dec" \ No newline at end of file