Skip to content

Instantly share code, notes, and snippets.

@anu1097
Created March 11, 2017 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anu1097/90687ebf64a9895157b1248e825e577d to your computer and use it in GitHub Desktop.
Save anu1097/90687ebf64a9895157b1248e825e577d to your computer and use it in GitHub Desktop.
#!/bin/bash
#rm /home/hackerman/TecMul/TM/*.txt #Cambiar ruta por la que contenga los txt
#cd /home/hackerman/p2psp-console/bin/ #Cambiar ruta por la que tenga el p2psp-console
cd ~/p2psp-console/bin
while getopts "a:" opt; do
case ${opt} in
a)
NUM_PEERS="${OPTARG}"
;;
\?)
echo "Invalid option: -${OPTARG}"
;;
esac
done
TIME=`shuf -i 20-50 -n 1`
cvlc ~/Videos/Big_Buck_Bunny_small.ogv --sout "#http{mux=ogg,dst=:$SourcePort/BBB.ogv}" :sout-keep &
timeout $TIME ./splitter --source_addr 127.0.0.1 --source_port 8080 --splitter_port 8001 --channel BBB-134.ogv --header_size 30000 > ~/Documents/Codes/automatic-test/TM/splitter.txt&
timeout $TIME ./monitor --splitter_addr 127.0.0.1 --splitter_port 8001 > ~/Documents/Codes/automatic-test/monitor.txt &
timeout $TIME vlc http://localhost:9999 &
for ((i=0; i < $NUM_PEERS; i++))
do
PORT_RANDOM=`shuf -i 2000-65000 -n 1`
echo $PORT_RANDOM
timeout $TIME ./peer --splitter_addr 127.0.0.1 --splitter_port 8001 --player_port $PORT_RANDOM > ~/Documents/Codes/automatic-test/TM/peers$PORT_RANDOM.txt &
sleep 0.5
timeout $TIME nc localhost $PORT_RANDOM > /dev/null &
done
sleep $TIME;
echo -e "\n\n\nSpliter.txt\n\n\n"
cat ~/Documents/Codes/automatic-test/TM/splitter.txt
echo -e "\n\n\nMonitor.txt\n\n\n"
cat ~/Documents/Codes/automatic-test/TM/monitor.txt
echo -e "\n\n\nPeer$PORT_RANDOM.txt\n\n\n"
cat ~/Documents/Codes/automatic-test/TM/peer$PORT_RANDOM.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment