-
Notifications
You must be signed in to change notification settings - Fork 0
/
stopCluster.sh
34 lines (28 loc) · 913 Bytes
/
stopCluster.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
#!/bin/bash
# cluster will automatically shut in 30 minutes.
sleep 1800
status=$(cat clusterState)
if [ "$status" = "started" ]; then
# Succesfully stopping
echo "stopping" > clusterState
./logger.sh Cluster stopping initiated
success=$(./changeBackend.sh rhime http://localhost:3000)
if [ "$success" = "false" ]
then
echo "error" > clusterState
./logger.sh Error occured inside stopCluster - changeBackend request
exit 1
fi
./logger.sh Falcon url changed to localhost:3000
# stopping the aks cluster
./logger.sh Sending the stop request to the cluster
res=$(az aks stop --name rhimecluster --resource-group RhimeGroup)
./stopChecker.sh
# start some cron job to track change
exit 0
else
echo "error" > clusterState
./logger.sh Error occured inside stopCluster.sh
exit 1
# show some error, that try again
fi