From 80a39f860fe58bde2f25e39bd89b6b8f87dac891 Mon Sep 17 00:00:00 2001 From: Peter Reichart Date: Mon, 27 Mar 2023 14:15:56 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=9Estartstop.sh=E2=80=9C=20hinzuf=C3=BCge?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- startstop.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 startstop.sh diff --git a/startstop.sh b/startstop.sh new file mode 100644 index 00000000..c00e06ec --- /dev/null +++ b/startstop.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# +# Startet/Stoppt/entfernt alle docker-compose.yml Stacks in den Unterverzeichnissen +# + +STACKS=$(ls -d */ | tr -d "/" | tr "\n" " ") + +compose() +{ + for STACK in $STACKS; + do + echo "Verzeichnis: $STACK" + if [ -e $STACK/docker-compose.yaml ] + then + echo " Container $STACK ..." + cd $STACK + $1 + cd .. + elif [ -e $STACK/docker-compose.yml ] + then + echo " Container $STACK ..." + cd $STACK + $1 + cd .. + fi + done +} + +case $1 in + +down) + compose "docker compose down" +;; + +start) + compose "docker compose up -d" +;; + +stop) + compose "docker compose stop" +;; + +*) + echo "Usage: $0 [start|stop|down]" +;; +esac