-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremoteTest.sh
More file actions
executable file
·57 lines (48 loc) · 2.07 KB
/
remoteTest.sh
File metadata and controls
executable file
·57 lines (48 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
mvn package
#Code to install maven
ssh_key_loc="~/.ssh/id_rsa"
ssh_user_name="root"
#ip_list="ip1 ip2 ip3"
ip_list="138.197.22.178"
#array=( "ip1" "ip2" "ip3")
array=( "138.197.22.178")
num_of_test_runs=1
mss=1000
loss_probablity=0.01
echo "####################Installing Dependencies####################"
for ip in "${array[@]}"
do
ssh -i $ssh_key_loc $ssh_user_name@$ip 'apt-get update -y'
ssh -i $ssh_key_loc $ssh_user_name@$ip 'apt-get install -y default-jdk'
ssh -i $ssh_key_loc $ssh_user_name@$ip 'apt-get install -y maven'
done
echo "####################Copying Binary/Executable####################"
for ip in "${array[@]}"
do
ssh -i $ssh_key_loc $ssh_user_name@$ip 'killall java'
ssh -i $ssh_key_loc $ssh_user_name@$ip 'rm -rf code'
ssh -i $ssh_key_loc $ssh_user_name@$ip 'mkdir code'
scp -i $ssh_key_loc ./target/P2MP-FTP-0.1-jar-with-dependencies.jar $ssh_user_name@$ip:code/P2MP-FTP-0.1-jar-with-dependencies.jar
scp -i $ssh_key_loc ./test.txt $ssh_user_name@$ip:code/test.txt
done
cp test.txt target/test.txt
cd target
for (( i=1; i<=$num_of_test_runs; i++))
do
for ip in "${array[@]}"
do
echo "####################Stopping already running java processes on client " $ip " ####################"
ssh -i $ssh_key_loc $ssh_user_name@$ip 'killall java'
ssh -i $ssh_key_loc $ssh_user_name@$ip 'cd code;rm -rf testRecvd'
ssh -i $ssh_key_loc $ssh_user_name@$ip 'cd code;java -cp P2MP-FTP-0.1-jar-with-dependencies.jar main/P2mpserver 7735 testRecvd '"$loss_probablity"'' &
done
echo "####################Stopping already running java processes on client####################"
killall java
java -cp P2MP-FTP-0.1-jar-with-dependencies.jar main/P2mpclient $ip_list 7735 test.txt $mss > logs_$i.txt
for ip in "${array[@]}"
do
ssh -i $ssh_key_loc $ssh_user_name@$ip 'cd code;diff test.txt testRecvd' > file_diff_"$ip"_"$i".txt
done
done
echo "####################Test Finished####################"