forked from jimflynn/kuwa-tcup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pids.sh
executable file
·60 lines (55 loc) · 1.01 KB
/
pids.sh
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
52
53
54
55
56
57
58
#!/bin/bash
# This script lists the PIDs of processes listening on ports used by Kuwa/TCUP.
# You may have to sudo this script.
# Use sudo kill -9 to terminate processes if required.
function show {
name=''
if [ "$2" != "" ]
then
case $2 in
3000)
name="(Sponsor)"
;;
3001)
name="(Sponsor UI)"
;;
3002)
name="(Sponsor)"
;;
3003)
name="(StorageManager)"
;;
3005)
name="(Registrar)"
;;
3006)
name="(Registrar Back-end)"
;;
3010)
name="(Directory)"
;;
3011)
name="(Directory Client)"
;;
3015)
name="(Faucet)"
;;
3020)
name="(BasicIncome)"
;;
3021)
name="(BasicIncome https)"
;;
*)
;;
esac
echo "PID $1 is on port $2 $name"
fi
}
echo -e "\nPIDs of processes listening on ports 3000 to 3021:\n"
for i in {3000..3021}
do
#netstat -ltnp | grep -w "$i" | cut -d 'N' -f 2 | cut -d '/' -f 1 | cut -d ' ' -f 7
show $(netstat -ltnp | grep -w "$i" | cut -d 'N' -f 2 | cut -d '/' -f 1 | cut -d ' ' -f 7) $i
done
echo ''