-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathforkportsq
53 lines (45 loc) · 1.83 KB
/
forkportsq
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
40
41
42
43
44
45
46
47
48
49
50
51
#! /usr/bin/env bash
function print_usage () {
echo "forkports help:"
echo
echo "SYNOPSIS: Checks port locking contention on all forks with an active _harvester process."
echo " Extracts a list of every port used by each fork from the fork's config.yaml, then"
echo " runs 'ss' scanning for any process using those ports that does not contain that fork's"
echo " name as the owner of the process."
echo " If the listed processes don't have a *different* fork or app's name as the owner of the"
echo " process, that output can probably be safely disregarded. If no processes are listed under a"
echo " given fork in the output, no ports were locked by a different fork - i.e., no conflict found."
echo
echo "PARAMETERS:"
echo " -help | --help Show this information again."
echo
exit 0
}
. ftinit.sh
cd $FORKTOOLSBLOCKCHAINDIRS
FORKLIST=$( ls -d1 *-blockchain | sed 's/-blockchain//' )
PROCESSEF=$(ps -ef | grep -e 'full_node' -e 'farmer' -e 'harvester' -e 'wallet' -e '_daemon' | grep -v grep | awk '{ print $8 } ' | sort | uniq )
CHIAPROCS=$(forkss | grep "\"chia" )
FORKSS=$(forkss)
for fork in $FORKLIST; do
CURRENTCONFIG=$FORKTOOLSHIDDENDIRS/.$fork/mainnet/config/config.yaml
if [[ ! -f $CURRENTCONFIG ]]; then
continue
fi
SCANNEDMSG=0
FORKNAME=$fork
. $FORKTOOLSDIR/ftparseports.sh
PORTLIST=$( echo $FULLNODEPORT $FULLNODERPCPORT $FARMERPORT $FARMERRPCPORT $HARVESTERPORT $HARVESTERRPCPORT $WALLETPORT $WALLETRPCPORT $DAEMONPORT )
. $FORKTOOLSDIR/ftcheckports.sh
PROCESSNAME=$(echo $fork)
if [[ $USINGCHIAPROCESSNAMES == 1 ]]; then
PROCESSNAME='chia'
fi
for port in $PORTLIST; do
# echo $fork $port
forkssoutput
done
if [[ $SCANNEDMSG == 0 ]]; then
printf "Scanned %-15.15s - no conflicts found.\n" $fork
fi
done