This repository has been archived on 2024-11-01. You can view files and clone it, but cannot push or open issues or pull requests.
services/roles/teamspeak_fallback/templates/conditional-start.sh.j2

18 lines
412 B
Django/Jinja

#!/usr/bin/env sh
while true
do
if nc -z "{{ teamspeak_fallback_check_server }}" "{{ teamspeak_fallback_check_port }}"
then
if docker compose ps --services | grep teamspeak >/dev/null; then
echo "Stopping Server"
docker compose down
fi
else
if ! docker compose ps --services | grep teamspeak >/dev/null; then
echo "Starting Server"
docker compose up -d --pull=always
fi
fi
sleep 5
done