add timeout option to portal-down script

This commit is contained in:
Karol Wypchlo 2021-01-21 12:15:10 +01:00
parent ba7cb64d34
commit 7024b680e7
1 changed files with 7 additions and 2 deletions

View File

@ -2,6 +2,11 @@
set -e # exit on first error
TIMEOUT=${1:-300} # default timeout is 300s
if ! [[ "$TIMEOUT" =~ ^[0-9]+$ ]]; then
echo "Timeout has to be valid integer" && exit 1
fi
countdown() {
local secs=$1
while [ $secs -gt 0 ]; do
@ -12,7 +17,7 @@ countdown() {
}
# stop healh-check so the server is taken our of load balancer
docker exec health-check cli/disable
# docker exec health-check cli/disable
# then wait 5 minutes for the load balancer to propagate the dns records
countdown 300
countdown $TIMEOUT