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. # if we found a running stack, bring it down.
echo "Removing stack $RUNNING_STACK..." echo "Removing stack $RUNNING_STACK..."
docker stack rm $RUNNING_STACK docker stack rm $RUNNING_STACK
echo "Waiting for 30 seconds for services to terminate..." WAIT=30
sleep 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 #!/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 if [ ! -z $1 ]; then
START_DIR="$1" START_DIR="$1"
else else
@ -19,7 +37,7 @@ do
echo "Updating $CURRENT_DIR..." echo "Updating $CURRENT_DIR..."
cd $CURRENT_DIR cd $CURRENT_DIR
if [ ! -f ".update.ignore" ]; then 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 else
echo "Stack flagged for ignore updates" echo "Stack flagged for ignore updates"
fi fi