Skip to content

Commit

Permalink
don't use jq as it's not installed by default
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Sep 13, 2024
1 parent 172e325 commit d4da4c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions subnet/deployment-generator/scripts/check-mining.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion subnet/deployment-generator/scripts/check-peer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit d4da4c3

Please sign in to comment.