You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docker-wireguard/root/etc/s6-overlay/s6-rc.d/svc-coredns/run

24 lines
711 B
Plaintext

#!/usr/bin/with-contenv bash
# shellcheck shell=bash
if netstat -apn | grep -q ":53 "; then
USE_COREDNS="false"
fi
if [[ ${USE_COREDNS} == "false" ]]; then
s6-notifyoncheck -d -n 300 -w 1000 -c "echo **** Disabling CoreDNS ****" \
sleep infinity
else
if grep -q "health" /config/coredns/Corefile; then
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "redirfd -w 1 /dev/null curl -s http://localhost:8080/health" \
cd /config/coredns \
/usr/bin/coredns -dns.port=53
else
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -zu localhost 53" \
cd /config/coredns \
/usr/bin/coredns -dns.port=53
fi
fi