-
-
Save fivepiece/07fdaa7bce38ffa0c77bdb5c40a69a25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
clientname=${1:-bitcoin} | |
field='id|"addr": "|lastrecv|bytessent"|bytesrecv"|conntime|pingtime|subver|inbound' | |
peerinf=( $(${clientname}-cli getpeerinfo | tr -d , | grep -E "${field}" | sed -e 's/^ *"[a-z]*"://g' -e 's/; /;_/g') ); | |
(echo -e "\n${field//[\":|]/ }\n"; | |
for ((i=0; i<${#peerinf[@]}; i+=9)); do | |
printf "%03d %s %(%R)T %.2e %.2e %(%R,%d/%m)T %.2f %.55s %c\n" $(\ | |
eval "echo $( eval "echo peerinf[{$i..$((i+8))}] | sed -e 's/pe/\${pe/g' -e 's/]/]}/g'" )" ); | |
done; echo -e "\npeers: $((i/9))") | column -te; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment