Added countdown time to docker-stack-rm.

Added check for compose plugin and legacy docker-compose.
This commit is contained in:
bkraul 2023-06-16 18:13:11 -05:00
parent de73b968bc
commit f5d8b3422a
2 changed files with 22 additions and 4 deletions

View File

@ -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
WAIT=30
for i in `seq $WAIT -1 1` ; do echo -ne "\rWaiting $i seconds for services to terminate..." ; sleep 1 ; done

View File

@ -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