#!/bin/bash if [ -f /opt/docker/startup/.env ] then echo "OK: .env file found" source /opt/docker/startup/.env else echo '.env is missing, please consult README.md' && exit 1 fi # test if a variable with the hostname of the machine, # as defined in $HOSTNAME, exists if [ ! -z "${!HOSTNAME}" ] then echo "OK: Container list found in \$$HOSTNAME" else echo "NOK: No container list found for $HOSTNAME" && exit 1 fi up() { for service in ${!HOSTNAME} do cd $service docker compose up -d --remove-orphans done } down() { for service in $services do cd $service docker compose down done } pull() { for service in $services do cd $service docker compose pull done } case "$1" in up) up ;; down) down ;; pull) pull ;; *) echo $"Usage: $0 {up|down|pull}" exit 1 esac