From 4061c8679ecf2c055f4679e0c2171d431a43c502 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sun, 19 Jun 2022 19:19:48 +0200 Subject: [PATCH] detect zone updates + execute bind-reload-now --- Dockerfile | 1 + start.sh | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e2bb018..90353ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ RUN set -eux; \ pdns-backend-bind \ sqlite3 \ bind9-dnsutils \ + inotify-tools \ ; \ rm -rf /var/lib/apt/lists/* diff --git a/start.sh b/start.sh index 8e6f909..e7502a2 100755 --- a/start.sh +++ b/start.sh @@ -1,3 +1,11 @@ #!/bin/sh -exec /usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no +/usr/sbin/pdns_server --guardian=no --daemon=no --disable-syslog --log-timestamp=no --write-pid=no & + +inotifywait -mqre modify --exclude '\.git' --format '%w%f' "/var/lib/powerdns/zones/" | + while read -r path; do + zone=$(basename $path) + echo [$0] A modification was detected in $path + echo [$0] Executing \`/usr/bin/pdns_control bind-reload-now $zone\` + /usr/bin/pdns_control bind-reload-now $zone + done