infrastructure/roles/teamspeak_fallback/templates/conditional-start.sh.j2

18 lines
437 B
Django/Jinja

#!/usr/bin/env sh
while true
do
if nc -z -w 3 "{{ 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 teamspeak
fi
else
if ! docker compose ps --services | grep teamspeak >/dev/null; then
echo "Starting Server"
docker compose up -d --pull=always teamspeak
fi
fi
sleep 2
done