Files
mtusi2026lab2/scripts/restart.sh
T

8 lines
429 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# Перезапуск PostgreSQL и API с сохранением volumes (без down -v): сначала БД, после её готовности — API.
set -eu
cd "$(dirname "$0")/.." || exit 1
docker compose restart postgres >/dev/null
docker compose exec -T postgres sh -c 'i=0; until pg_isready -U msg -d msg -q; do i=$((i+1)); [ "$i" -gt 60 ] && exit 1; sleep 1; done'
docker compose restart api >/dev/null