-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremote-start-stop-easytravel.sh
63 lines (49 loc) · 2.02 KB
/
remote-start-stop-easytravel.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
#!/bin/bash
#design by JLLormeau Dynatrace
# version beta
. ./env.sh
response=$1
END_ENV=$(($START_ENV + $NBENV))
while [[ $response != "stress" ]] && [[ $response != "restart" ]] && [[ $response != "restartmongo" ]] && [[ $response != "stopmongo" ]] && [[ $response != "issue" ]] && [[ $response != "status" ]] && [[ $response != "start" ]] && [[ $response != "stop" ]]
do
read -p "start | stop | restart | restartmongo | stopmongo | issue | stress | status = " response
done
if [ $response = "stress" ]
then
response='run stress '$2' '$3' '$4' '$5' '$6' '$7' '$8' '$9' '$11' '$12
echo $response
fi
i=$START_ENV
while [[ $i -lt $END_ENV ]]
do
echo $i
if [ $i -lt 5 ]
then
X='0' #from 00 to 04
LOCATION=$LOCATION1
echo 'run ssh user'$X$i'@'$DOMAIN_NAME$X$i'.'$LOCATION'.cloudapp.azure.com' $response
ssh -tt -oStrictHostKeyChecking=no 'user'$X$i'@'$DOMAIN_NAME$X$i'.'$LOCATION'.cloudapp.azure.com' '/home/dynatracelab_easytraveld/start-stop-easytravel.sh' $response &
fi
if [ $i -ge 5 ] && [ $i -lt 10 ]
then
X='0' #from 05 to 09
LOCATION=$LOCATION2
echo 'run ssh user'$X$i'@'$DOMAIN_NAME$X$i'.'$LOCATION'.cloudapp.azure.com' $response
ssh -tt -oStrictHostKeyChecking=no 'user'$X$i'@'$DOMAIN_NAME$X$i'.'$LOCATION'.cloudapp.azure.com' '/home/dynatracelab_easytraveld/start-stop-easytravel.sh' $response &
fi
if [ $i -ge 10 ] && [ $i -lt 15 ]
then
X='' #from 10 to 14
LOCATION=$LOCATION3
echo 'run ssh user'$i'@'$DOMAIN_NAME$i'.'$LOCATION'.cloudapp.azure.com' $response
ssh -tt -oStrictHostKeyChecking=no 'user'$i'@'$DOMAIN_NAME$i'.'$LOCATION'.cloudapp.azure.com' '/home/dynatracelab_easytraveld/start-stop-easytravel.sh' $response &
fi
if [ $i -ge 15 ] && [ $i -lt 20 ]
then
X='' #from 10 to 20
LOCATION=$LOCATION4
echo 'run ssh user'$i'@'$DOMAIN_NAME$i'.'$LOCATION'.cloudapp.azure.com' $response
ssh -tt -oStrictHostKeyChecking=no 'user'$i'@'$DOMAIN_NAME$i'.'$LOCATION'.cloudapp.azure.com' '/home/dynatracelab_easytraveld/start-stop-easytravel.sh' $response &
fi
i=$(($i + 1))
done