-
Notifications
You must be signed in to change notification settings - Fork 8
/
forknodesq
40 lines (35 loc) · 1.32 KB
/
forknodesq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /usr/bin/env bash
function print_usage () {
echo "forknodes help:"
echo
echo "SYNOPSIS: Prints a list of IP addresses and ports for all currently connected network nodes/peers"
echo " for the specified fork in a format useful for sharing with others having difficulty connecting"
echo " to the network."
echo " Prepends each node and port with 'forkname show -a' (or 'forkname peers full_node -a' in"
echo " more recent versions of the chia code) for easy CLI connection command via cut and paste."
echo
echo "PARAMETERS:"
echo " forkname Required."
echo " -f Prepend 'fork ' to each line of output for sharing nodes with other forktools users."
echo " -help | --help Show this information again."
echo
exit 0
}
VALIDATEFORKNAME='Yes'
. ftinit.sh
if [[ $2 == '-f' ]]; then
FORFORKTOOLS='fork '
fi
cd $FORKTOOLSBLOCKCHAINDIRS/$1-blockchain
. ./activate
for port in $($1 show -c | grep "^FULL_NODE" | awk '{print $2,$3}' | sed 's/ [0-9]*\//:/' ); do
SHOWSTILLWORKS=1
echo $FORFORKTOOLS $1 "show -a" $port
done
if [[ $SHOWSTILLWORKS != 1 ]]; then
for port in $($1 peer full_node -c | grep "^FULL_NODE" | awk '{print $2,$3}' | sed 's/ [0-9]*\//:/' ); do
echo $FORFORKTOOLS $1 "peer full_node -a" $port
done
fi
echo
deactivate