-
Notifications
You must be signed in to change notification settings - Fork 1
/
linuxClientTest.sh
68 lines (56 loc) · 1.33 KB
/
linuxClientTest.sh
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
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
if [ $# -ne 5 ]; then
echo "plz input 5 param for this shell"
echo "bash linuxClientTest.sh [clientKeyFile] [serverNum] [clientIndex] [t] [u]"
exit 1;
fi
clientPrivateKeyFile=${1}
serverNum=${2}
clientIndex=${3}
t=${4}
u=${5}
startServerPort=5000
serverInfoList=("141.223.121.163 12"
"141.223.121.164 8")
registeredNum=0
addrStr=""
for elem in "${serverInfoList[@]}"
do
data=(${elem[0]})
ip=${data[0]}
num=`expr ${data[1]} - 1`
for i in $(seq 0 $num);
do
port=`expr $startServerPort + $i`
addrStr=$addrStr","$ip:$port
registeredNum=`expr $registeredNum + 1`
if [ $registeredNum -eq $serverNum ]; then
break 2
fi
done
done
addrStr=${addrStr:1}
userId="user"$clientIndex
clientPrvKey=`awk 'NR==v1' v1=$clientIndex $clientPrivateKeyFile`
./dkms client register $userId $clientPrvKey $addrStr --t=$t --u=$u
echo "Finish registered.. now register to checker"
sleep 3
./dkms client check $userId $addrStr
echo "Finish register to checker.. now start checker daemon"
sleep 3
startCheckerNum=0
for elem in "${serverInfoList[@]}"
do
data=(${elem[0]})
ip=${data[0]}
num=`expr ${data[1]} - 1`
for i in $(seq 0 $num);
do
port=`expr $startServerPort + $i`
./dkms server startChecker --ip=$ip --port=$port
startCheckerNum=`expr $startCheckerNum + 1`
if [ $startCheckerNum -eq $serverNum ]; then
break 2
fi
done
done