From f5d8b3422af4349cef0f0e13ea7cd66d639c7eaa Mon Sep 17 00:00:00 2001 From: bkraul Date: Fri, 16 Jun 2023 18:13:11 -0500 Subject: [PATCH] Added countdown time to docker-stack-rm. Added check for compose plugin and legacy docker-compose. --- docker-stack-rm | 4 ++-- docker-update-all | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/docker-stack-rm b/docker-stack-rm index 07ed246..730b3f8 100755 --- a/docker-stack-rm +++ b/docker-stack-rm @@ -18,5 +18,5 @@ RUNNING_STACK=$( echo $PARENT_DIR | cut -d " " -f1 ) # if we found a running stack, bring it down. echo "Removing stack $RUNNING_STACK..." docker stack rm $RUNNING_STACK -echo "Waiting for 30 seconds for services to terminate..." -sleep 30 \ No newline at end of file +WAIT=30 +for i in `seq $WAIT -1 1` ; do echo -ne "\rWaiting $i seconds for services to terminate..." ; sleep 1 ; done \ No newline at end of file diff --git a/docker-update-all b/docker-update-all index 6fe258d..14ce419 100755 --- a/docker-update-all +++ b/docker-update-all @@ -1,5 +1,23 @@ #!/bin/bash +COMPOSE_PLUGIN=$(docker compose >/dev/null 2>&1; if [ "$?" == "0" ]; then echo "true"; else echo "false"; fi) +COMPOSE_LEGACY=$(docker-compose >/dev/null 2>&1; if [ "$?" == "0" ]; then echo "true"; else echo "false"; fi) + +case "true" in + $COMPOSE_PLUGIN) + echo "using docker compose" + COMPOSE="docker compose" + ;; + $COMPOSE_LEGACY) + echo "using docker-compose" + COMPOSE="docker-compose" + ;; + *) + echo "No docker-compose found." + exit 1 + ;; +esac + if [ ! -z $1 ]; then START_DIR="$1" else @@ -19,10 +37,10 @@ do echo "Updating $CURRENT_DIR..." cd $CURRENT_DIR if [ ! -f ".update.ignore" ]; then - docker-compose pull --no-parallel && docker-compose up -d --remove-orphans 2>&1 + $COMPOSE pull --no-parallel && $COMPOSE up -d --remove-orphans 2>&1 else echo "Stack flagged for ignore updates" fi done -cd $START_DIR +cd $START_DIR \ No newline at end of file