Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #11262 from alphagov/tweak-reboot-script
Browse files Browse the repository at this point in the history
Improve flow of cache reboot script
  • Loading branch information
sihugh authored Nov 15, 2021
2 parents c3a2677 + fd33aff commit cb2ea4e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/reboot-cache-instances.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ echo "It has instance_id $instance_id"

asg_name=$(aws autoscaling describe-auto-scaling-instances --instance-ids "$instance_id" | jq .AutoScalingInstances[0].AutoScalingGroupName -r)

echo "Setting $instance_id to standby in ASG $asg_name"
aws autoscaling enter-standby --instance-ids "$instance_id" \
--auto-scaling-group-name "$asg_name" --should-decrement-desired-capacity
--auto-scaling-group-name "$asg_name" --should-decrement-desired-capacity | jq .Activities[0].Cause -r

function instanceState {
aws autoscaling describe-auto-scaling-instances --instance-ids "$instance_id" | jq .AutoScalingInstances[0].LifecycleState -r
Expand Down Expand Up @@ -85,7 +86,7 @@ done

echo "Putting instance back into service..."

aws autoscaling exit-standby --instance-ids "$instance_id" --auto-scaling-group-name "$asg_name"
aws autoscaling exit-standby --instance-ids "$instance_id" --auto-scaling-group-name "$asg_name" | jq .Activities[0].Cause -r

until [ "$(instanceState)" == "InService" ]
do
Expand Down

0 comments on commit cb2ea4e

Please sign in to comment.