diff options
author | Joe Crayne <joe@jerkface.net> | 2020-01-12 04:39:43 -0500 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2020-01-12 04:46:18 -0500 |
commit | 038fc07c26122bd65e07c079107abf8ab34f6278 (patch) | |
tree | 36cbe9e47b225d6ba8e7b87b418b3050d062b8d7 | |
parent | f71f6139f4401474166a41b8918df7e29318c405 (diff) |
Utilities for getting information about a test network.
-rwxr-xr-x | dht/vnet/core-gettcp.sh | 22 | ||||
-rwxr-xr-x | dht/vnet/core-kill.sh | 2 | ||||
-rwxr-xr-x | dht/vnet/core-top.sh | 2 | ||||
-rwxr-xr-x | dht/vnet/getnodes.sh | 2 | ||||
-rwxr-xr-x | dht/vnet/gettcp.sh | 7 | ||||
-rwxr-xr-x | dht/vnet/load-nodes.sh | 8 | ||||
-rwxr-xr-x | dht/vnet/load-tcp.sh | 8 |
7 files changed, 51 insertions, 0 deletions
diff --git a/dht/vnet/core-gettcp.sh b/dht/vnet/core-gettcp.sh new file mode 100755 index 00000000..12204b84 --- /dev/null +++ b/dht/vnet/core-gettcp.sh | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/usr/bin/awk --exec | ||
2 | BEGIN { | ||
3 | for( ARGC=1; ARGC<17; ARGC++ ) { | ||
4 | ARGV[ARGC] = "ve" sprintf("%X",ARGC - 1) "/PUBLIC_ID.txt"; | ||
5 | } | ||
6 | } | ||
7 | |||
8 | BEGINFILE { | ||
9 | boot_key = ""; | ||
10 | boot_port = ""; | ||
11 | boot_ip = ""; | ||
12 | boot_tcp = ""; | ||
13 | } | ||
14 | |||
15 | { | ||
16 | if ( boot_key == "" ) boot_key=$0; | ||
17 | else if( boot_port == "" && $1 == "Port:" ) boot_port=$2; | ||
18 | else if( boot_ip == "" && $1 == "IP:" ) boot_ip=$2; | ||
19 | else if( boot_tcp == "" && $1 == "TCP:" ) boot_tcp=$2; | ||
20 | } | ||
21 | |||
22 | ENDFILE { print( boot_key "@" boot_ip ":" boot_port "{tcp:" boot_tcp "}" ); } | ||
diff --git a/dht/vnet/core-kill.sh b/dht/vnet/core-kill.sh new file mode 100755 index 00000000..c807b53a --- /dev/null +++ b/dht/vnet/core-kill.sh | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | for p in $(cat ???/pid); do kill $p; done | ||
diff --git a/dht/vnet/core-top.sh b/dht/vnet/core-top.sh new file mode 100755 index 00000000..fe5d34dd --- /dev/null +++ b/dht/vnet/core-top.sh | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | top $(sed 's/^/-p /' ve?/pid) "$@" | ||
diff --git a/dht/vnet/getnodes.sh b/dht/vnet/getnodes.sh new file mode 100755 index 00000000..b435883d --- /dev/null +++ b/dht/vnet/getnodes.sh | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | ./everywhere.sh ../dht ls | grep node-id | sed 's/ *node-id/ping/' > nodes.txt | ||
diff --git a/dht/vnet/gettcp.sh b/dht/vnet/gettcp.sh new file mode 100755 index 00000000..7e9a9212 --- /dev/null +++ b/dht/vnet/gettcp.sh | |||
@@ -0,0 +1,7 @@ | |||
1 | #!/bin/bash | ||
2 | sudo netstat -lnp | grep 'tcp.*dht' | \ | ||
3 | awk '{ split($4,a,":"); port=a[length(a)]; pid=int($7) ; system ("readlink /proc/" pid "/cwd | sed s,$,\\ {tcp:" port "},") }' | \ | ||
4 | sort | \ | ||
5 | while read path port; do | ||
6 | ( cd $path ; ../dht ls | grep node-id |sed 's/ *node-id//; s/$/'$port/ ) | ||
7 | done > ports.txt | ||
diff --git a/dht/vnet/load-nodes.sh b/dht/vnet/load-nodes.sh new file mode 100755 index 00000000..3c247c4c --- /dev/null +++ b/dht/vnet/load-nodes.sh | |||
@@ -0,0 +1,8 @@ | |||
1 | #!/bin/sh | ||
2 | cmd="$@" | ||
3 | for ep in ep? | ||
4 | do | ||
5 | ( cd $ep | ||
6 | ../dht < ../nodes.txt | ||
7 | ) | ||
8 | done | ||
diff --git a/dht/vnet/load-tcp.sh b/dht/vnet/load-tcp.sh new file mode 100755 index 00000000..9fd3b553 --- /dev/null +++ b/dht/vnet/load-tcp.sh | |||
@@ -0,0 +1,8 @@ | |||
1 | #!/bin/sh | ||
2 | cmd="$@" | ||
3 | for ep in ep? | ||
4 | do | ||
5 | ( cd $ep | ||
6 | ( echo "toxtcp" ; sed s,^,ping, ../ports.txt ) | ../dht | ||
7 | ) | ||
8 | done | ||