Created
May 15, 2024 20:34
-
-
Save casebeer/2b91d2488646b6a801cf58184b999297 to your computer and use it in GitHub Desktop.
Flush Unbound DNS local auth-zones and their cached entries after updating zonefiles (and serial numbers).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set path to directory holding docker-compose.yaml | |
#dockerComposeRoot= | |
if [ -z "$dockerComposeRoot" ]; then | |
echo "ERROR: Set dockerComposeRoot before calling $0" >&2 | |
exit 1 | |
fi | |
( | |
cd "$dockerComposeRoot" | |
# read via FD3 to avoid disruption from processing of stdin/stdout by loop contents | |
while read -u 3 zone ; do | |
echo "Flushing zone ${zone}" >&2 | |
docker-compose exec -T unbound unbound-control -s 127.0.0.1 auth_zone_reload "$zone" | |
docker-compose exec -T unbound unbound-control -s 127.0.0.1 flush_zone "$zone" | |
done 3< <(docker-compose exec -T unbound unbound-control -s 127.0.0.1 list_auth_zones | cut -f 1) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment