Files
mtusi2026lab2/scripts/postgres_outage.sh
T

21 lines
391 B
Bash
Executable File

#!/bin/sh
set -eu
project_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
cd "$project_root"
env_file=${ENV_FILE:-.env}
case "${DATABASE_ACTION:-}" in
stop)
docker compose --env-file "$env_file" stop postgres
;;
start)
docker compose --env-file "$env_file" up -d --wait postgres
;;
*)
echo "DATABASE_ACTION must be stop or start" >&2
exit 2
;;
esac