run_network.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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 -D --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. # Client with 1 outgoing connection
  11. "cargo run --bin dfi -- -r 9002 --seeds 127.0.0.1:9999 --slots 1 --log /tmp/darkfi/client.log"
  12. # Client with 1 outgoing connection
  13. "cargo run --bin dfi -- -r 9003 --seeds 127.0.0.1:9999 --slots 1 --log /tmp/darkfi/client1.log"
  14. # Client with 1 outgoing connection
  15. "cargo run --bin dfi -- -r 9004 --seeds 127.0.0.1:9999 --slots 1 --log /tmp/darkfi/client2.log"
  16. # Server/client with 2 outgoing connections
  17. "cargo run --bin dfi -- -r 9005 --accept 127.0.0.1:10002 --seeds 127.0.0.1:9999 --log /tmp/darkfi/server1.log" --slots 2
  18. )
  19. for cmd in "${arr[@]}"; do {
  20. echo "Process \"$cmd\" started";
  21. RUST_BACKTRACE=1 $cmd & pid=$!
  22. PID_LIST+=" $pid";
  23. } done
  24. trap "kill $PID_LIST" SIGINT
  25. echo "Parallel processes have started";
  26. wait $PID_LIST
  27. echo
  28. echo "All processes have completed";