This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/scripts/portal-down.sh

32 lines
651 B
Bash
Raw Permalink Normal View History

2020-09-04 12:55:30 +00:00
#!/bin/bash
set -e # exit on first error
2021-01-21 11:29:31 +00:00
while getopts d:t: flag
do
case "${flag}" in
d) delay=${OPTARG};;
t) timeout=${OPTARG};;
esac
done
delay=${delay:-0} # default to no delay
timeout=${timeout:-300} # default timeout is 300s
2020-09-04 12:55:30 +00:00
countdown() {
local secs=$1
while [ $secs -gt 0 ]; do
echo -ne "Waiting $secs\033[0K\r"
sleep 1
: $((secs--))
done
}
2021-01-21 11:29:31 +00:00
# delay disabling the portal
countdown $delay
2020-09-14 15:40:18 +00:00
# stop healh-check so the server is taken our of load balancer
2021-01-21 11:29:31 +00:00
docker exec health-check cli/disable
2020-09-04 12:55:30 +00:00
# then wait 5 minutes for the load balancer to propagate the dns records
2021-01-21 11:29:31 +00:00
countdown $timeout