run_network.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # Run this script then
  3. # python scripts/monitor-p2p.py
  4. # to view the network topology
  5. declare -a arr=(
  6. # Seed node
  7. "cargo run --bin dfi -- -r 8999 --accept 127.0.0.1:9999 --log /tmp/darkfi/seed.log"
  8. # Server with no outgoing connections
  9. "cargo run --bin dfi -- -r 9000 --accept 127.0.0.1:10001 --seeds 127.0.0.1:9999 --log /tmp/darkfi/server.log"
  10. # Server/client with 2 outgoing connections
  11. "cargo run --bin dfi -- -r 9005 --accept 127.0.0.1:10002 --seeds 127.0.0.1:9999 --log /tmp/darkfi/server1.log --slots 3"
  12. # Server/client with 2 outgoing connections
  13. "cargo run --bin dfi -- -r 9006 --accept 127.0.0.1:10003 --seeds 127.0.0.1:9999 --log /tmp/darkfi/server2.log --slots 3"
  14. # Server/client with 2 outgoing connections
  15. "cargo run --bin dfi -- -r 9007 --accept 127.0.0.1:10004 --seeds 127.0.0.1:9999 --log /tmp/darkfi/server3.log --slots 3"
  16. # Server/client with 2 outgoing connections
  17. "cargo run --bin dfi -- -r 9008 --accept 127.0.0.1:10005 --seeds 127.0.0.1:9999 --log /tmp/darkfi/server4.log --slots 3"
  18. # Client with 1 outgoing connection
  19. "cargo run --bin dfi -- -r 9002 --seeds 127.0.0.1:9999 --slots 4 --log /tmp/darkfi/client.log"
  20. # Client with 1 outgoing connection
  21. "cargo run --bin dfi -- -r 9003 --seeds 127.0.0.1:9999 --slots 4 --log /tmp/darkfi/client1.log"
  22. # Client with 1 outgoing connection
  23. "cargo run --bin dfi -- -r 9004 --seeds 127.0.0.1:9999 --slots 4 --log /tmp/darkfi/client2.log"
  24. )
  25. mkdir -p /tmp/darkfi/
  26. for cmd in "${arr[@]}"; do {
  27. echo "Process \"$cmd\" started";
  28. RUST_BACKTRACE=1 $cmd & pid=$!
  29. PID_LIST+=" $pid";
  30. sleep 2;
  31. } done
  32. trap "kill $PID_LIST" SIGINT
  33. echo "Parallel processes have started";
  34. wait $PID_LIST
  35. echo
  36. echo "All processes have completed";