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

19 lines
437 B
Text
Raw Normal View History

2024-09-26 22:02:36 +00:00
#!/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"
2024-10-13 19:02:19 +00:00
docker compose down teamspeak
2024-09-26 22:02:36 +00:00
fi
else
if ! docker compose ps --services | grep teamspeak >/dev/null; then
echo "Starting Server"
2024-10-13 19:02:19 +00:00
docker compose up -d --pull=always teamspeak
2024-09-26 22:02:36 +00:00
fi
fi
sleep 2
done