-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathpcf-start-stop.sh
75 lines (66 loc) · 1.92 KB
/
pcf-start-stop.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
68
69
70
71
72
73
#!/bin/bash
# Set for 1.5.x Jobs
export BUNDLE_GEMFILE=/home/tempest-web/tempest/web/bosh.Gemfile
if [ $1 == "shut" -o $1 == "start" ];
then
echo "Running PCF $1 Process..."
else
echo "Only shut or start are valid args!"
exit 1
fi
declare -a bootOrder=(
nats
consule_server
etcd_server
nfs_server
ccdb
uaadb
consoledb
cloud_controller
ha_proxy
router
health_manager
clock_global
cloud_controller_worker
uaa
mysql_proxy
mysql
dea
diego_brain
diego_cell
diego_database
doppler
loggregator_trafficcontroller
)
if [ $1 == "shut" ]; then
jobVMs=$(bundle exec bosh vms --detail|grep partition| awk -F '|' '{ print $2 }')
bundle exec bosh vm resurrection disable
for (( i=${#bootOrder[@]}-1; i>=0; i-- )); do
for x in $jobVMs; do
jobId=$(echo $x | awk -F "/" '{ print $1 }')
instanceId=$(echo $x | awk -F "/" '{ print $2 }')
jobType=$(echo $jobId | awk -F "-" '{ print $1 }')
if [ "$jobType" == "${bootOrder[$i]}" ];
then
#echo MATCHVAL---${bootOrder[$i]} JOBTYPE----$jobType JOBID----$jobId Instance-------$instanceId
bundle exec bosh -n stop $jobId $instanceId --hard
fi
done;
done
fi
if [ $1 == "start" ]; then
startJobVMs=$(bundle exec bosh vms --detail|grep partition| awk -F '|' '{ print $4 }')
bundle exec bosh vm resurrection enable
for x in ${bootOrder[@]}; do
for i in $startJobVMs; do
jobString=$i
jobPart=$(echo $jobString | awk -F "-" '{ print $3 }')
jobType=$(echo $jobString | awk -F "-" '{ print $1 }')
if [ "$x" == "$jobType" ];
then
#echo FOUND $jobString
bundle exec bosh -n start $jobString
fi
done;
done
fi