From 1b231b8fb5d98b2f75ac9d6506760eebd78b9879 Mon Sep 17 00:00:00 2001 From: Dirk Astrath Date: Thu, 15 Sep 2022 17:10:52 +0200 Subject: [PATCH] Add import_zone script from NS2 Signed-off-by: Jan Dittberner --- import_zone | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 import_zone diff --git a/import_zone b/import_zone new file mode 100644 index 0000000..c4d6153 --- /dev/null +++ b/import_zone @@ -0,0 +1,21 @@ +set -x +domain=$1 +now=$(date +"%Y%m%d_%H%M%S") +pdnsutil list-zone $1 > $1.$now +grep -v SOA $1 >$1.new +grep SOA $1.$now >> $1.new +pdnsutil load-zone $1 $1.new +pdnsutil increase-serial $1 +mysqldump powerdns > powerdns.dump.$now + +echo "From: Nameserver NS2 " > mail.txt +echo "To: critical-admin@cacert.org" >> mail.txt +echo "Subject: Update of zone $1" >> mail.txt +#echo "$1 has now the following zonefile-data:" >>mail.txt +pdnsutil list-zone $1 > $1.now +echo >>mail.txt +diff -u0 -b $1.$now $1.now >>mail.txt +echo " ------------------------- " >> mail.txt +pdnsutil list-zone $1 >> mail.txt + +cat mail.txt | ssmtp -6 critical-admin@cacert.org