71 lines
940 B
Bash
Executable File
71 lines
940 B
Bash
Executable File
#!/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
|
|
}
|
|
|
|
clean()
|
|
{
|
|
for STACK in $STACKS;
|
|
do
|
|
echo "Verzeichnis: $STACK"
|
|
if [ -e $STACK/volumes ]
|
|
then
|
|
echo " Volumes in $STACK loeschen..."
|
|
rm $STACK/volumes/* -rfv
|
|
fi
|
|
done
|
|
}
|
|
|
|
|
|
case $1 in
|
|
|
|
down)
|
|
compose "docker compose down"
|
|
;;
|
|
|
|
start)
|
|
compose "docker compose up -d"
|
|
;;
|
|
|
|
stop)
|
|
compose "docker compose stop"
|
|
;;
|
|
|
|
pull)
|
|
compose "docker compose pull"
|
|
;;
|
|
|
|
cleanup)
|
|
#compose "rm ./volumes/* -rf"
|
|
clean
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: $0 [start|stop|down]"
|
|
;;
|
|
esac
|