bring back up and down scripts
This commit is contained in:
parent
e281e9ca78
commit
63323685cc
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e # exit on first error
|
||||||
|
|
||||||
|
while getopts d:t:r: flag
|
||||||
|
do
|
||||||
|
case "${flag}" in
|
||||||
|
d) delay=${OPTARG};;
|
||||||
|
t) timeout=${OPTARG};;
|
||||||
|
r) reason=${OPTARG};;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
delay=${delay:-0} # default to no delay
|
||||||
|
timeout=${timeout:-300} # default timeout is 300s
|
||||||
|
|
||||||
|
if [[ -z $reason ]]; then
|
||||||
|
echo "Please provide a reason for disabling the portal (use '-r <reason>')."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
countdown() {
|
||||||
|
local secs=$1
|
||||||
|
while [ $secs -gt 0 ]; do
|
||||||
|
echo -ne "Waiting $secs\033[0K\r"
|
||||||
|
sleep 1
|
||||||
|
: $((secs--))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# delay disabling the portal
|
||||||
|
countdown $delay
|
||||||
|
|
||||||
|
# stop health-check so the server is taken our of load balancer
|
||||||
|
docker exec health-check cli disable $reason
|
||||||
|
|
||||||
|
# then wait 5 minutes for the load balancer to propagate the dns records
|
||||||
|
countdown $timeout
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e # exit on first error
|
||||||
|
|
||||||
|
# start the health-checks service
|
||||||
|
docker exec health-check cli enable
|
Reference in New Issue