diff options
Diffstat (limited to 'src/dht/dhtu_testbed_deploy.sh')
-rwxr-xr-x | src/dht/dhtu_testbed_deploy.sh | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/src/dht/dhtu_testbed_deploy.sh b/src/dht/dhtu_testbed_deploy.sh deleted file mode 100755 index 908bbf685..000000000 --- a/src/dht/dhtu_testbed_deploy.sh +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | # This file is in the public domain. | ||
3 | |||
4 | # We will use UDP ports above this number. | ||
5 | MINPORT=10000 | ||
6 | |||
7 | # Cleanup to run whenever we exit | ||
8 | function cleanup() | ||
9 | { | ||
10 | for n in `jobs -p` | ||
11 | do | ||
12 | kill $n 2> /dev/null || true | ||
13 | done | ||
14 | wait | ||
15 | } | ||
16 | |||
17 | # Install cleanup handler (except for kill -9) | ||
18 | trap cleanup EXIT | ||
19 | |||
20 | if test -z "$1" | ||
21 | then | ||
22 | echo "Call with the number of peers to launch." | ||
23 | exit 1 | ||
24 | fi | ||
25 | |||
26 | if test ! -x `which parallel` | ||
27 | then | ||
28 | echo "This script requires GNU parallel" | ||
29 | exit 1 | ||
30 | fi | ||
31 | |||
32 | if test ! -x `which gnunet-service-dht` | ||
33 | then | ||
34 | echo "This script requires gnunet-service-dht in \$PATH" | ||
35 | exit 1 | ||
36 | fi | ||
37 | |||
38 | if test ! -x `which gnunet-dht-hello` | ||
39 | then | ||
40 | echo "This script requires gnunet-dht-hello in \$PATH" | ||
41 | exit 1 | ||
42 | fi | ||
43 | |||
44 | MAX=`expr $1 - 1` | ||
45 | |||
46 | # export GNUNET_FORCE_LOG="dht*;;;;DEBUG" | ||
47 | |||
48 | echo -n "Starting $1 peers " | ||
49 | mkdir -p /tmp/deployment | ||
50 | for n in `seq 0 $MAX` | ||
51 | do | ||
52 | PORT=`expr $MINPORT + $n` | ||
53 | CFG="/tmp/deployment/${n}.conf" | ||
54 | cat dhtu_testbed_deploy.conf | sed -e "s/%N%/$PORT/" > $CFG | ||
55 | gnunet-service-dht -c $CFG &> /tmp/deployment/$n.log & | ||
56 | echo -n "." | ||
57 | done | ||
58 | |||
59 | echo "" | ||
60 | echo "$1 peers ready". | ||
61 | |||
62 | unset GNUNET_FORCE_LOG | ||
63 | |||
64 | function connect() | ||
65 | { | ||
66 | n=$1 | ||
67 | } | ||
68 | |||
69 | echo -n "Connecting peers ..." | ||
70 | |||
71 | export MAX | ||
72 | if test 0 != $MAX | ||
73 | then | ||
74 | seq 0 $MAX | parallel ./dhtu_testbed_connect.sh ::: | ||
75 | fi | ||
76 | |||
77 | |||
78 | echo "" | ||
79 | echo "Network ready. Press ENTER to terminate the testbed!" | ||
80 | echo "Interact with peers using '-c /tmp/deployment/\$N.conf'" | ||
81 | |||
82 | read | ||
83 | |||
84 | exit 0 | ||