email-amazon/manage-worker.sh

23 lines
495 B
Bash

#!/bin/bash
# manage-worker.sh
DOMAIN=$1
ACTION=${2:-up -d} # Default: up -d
if [ -z "$DOMAIN" ]; then
echo "Usage: $0 <domain> [action]"
echo "Example: $0 andreasknuth.de"
echo " $0 andreasknuth.de down"
echo " $0 andreasknuth.de logs -f"
exit 1
fi
PROJECT_NAME="${DOMAIN//./-}"
ENV_FILE=".env.${DOMAIN}"
if [ ! -f "$ENV_FILE" ]; then
echo "Error: $ENV_FILE not found!"
exit 1
fi
docker compose -p "$PROJECT_NAME" --env-file "$ENV_FILE" $ACTION