Files
skripte/ensure_zerotier.sh
2025-09-17 14:29:06 +02:00

21 lines
586 B
Bash
Raw Permalink 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/bash
set -euo pipefail
CONTAINER_NAME="zerotier"
# Prüfen, ob der Container existiert
if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}\$"; then
echo "Container '${CONTAINER_NAME}' existiert."
else
echo "Container '${CONTAINER_NAME}' existiert nicht!"
exit 1
fi
# Prüfen, ob der Container läuft
if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}\$"; then
echo "Container '${CONTAINER_NAME}' läuft bereits."
else
echo "Container '${CONTAINER_NAME}' läuft nicht starte ihn..."
docker start "${CONTAINER_NAME}"
fi