Created
February 5, 2020 18:03
-
-
Save michaeljfazio/c228ba598d7e9ff2d1499a402ea8231c to your computer and use it in GitHub Desktop.
Generate Peers List
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 | |
function extract() | |
{ | |
while read line | |
do | |
arr=( $(echo $line | tr ';' ' ') ) | |
addr=${arr[15]::-1} | |
ip=$(echo $addr | cut -d: -f1) | |
port=$(echo $addr | cut -d: -f2) | |
id=${arr[13]::-1} | |
echo "$id:$ip:$port" | |
done | |
} | |
journalctl -u jormungandr.service --since "1 hour ago" 2> /dev/null | grep "connecting to peer" | extract | sort | uniq | while read line | |
do | |
id=$(echo $line | cut -d: -f1) | |
ip=$(echo $line | cut -d: -f2) | |
port=$(echo $line | cut -d: -f3) | |
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | |
echo "- address: \"/ip4/$ip/tcp/$port\"" | |
echo " id: \"$id\"" | |
fi | |
done |
Jormungandr must have debug output logging turned on.
… On 8 Feb 2020, at 11:36 pm, citizen cosmos ***@***.***> wrote:
hi michael,
thanks for the sharing this. can you clarify the requirements for running it? i have jormungandr.service running as systemd but get a null result when executing it ./generate-peers.sh
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <https://gist.github.com/c228ba598d7e9ff2d1499a402ea8231c?email_source=notifications&email_token=AAOCPORFYY5ZJ5ZHHYB6IJLRB3GQXA5CNFSM4KR3FXW2YY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAGBQQI#gistcomment-3170564>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAOCPOS3OF6R2H2D4HFZLE3RB3GQXANCNFSM4KR3FXWQ>.
thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi michael,
thanks for the sharing this. can you clarify the requirements for running it? i have jormungandr.service running as systemd but get a null result when executing it ./generate-peers.sh