Skip to content

Instantly share code, notes, and snippets.

@totoCZ
Last active July 4, 2023 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save totoCZ/45a18acff72ff2b56028037d89f00173 to your computer and use it in GitHub Desktop.
Save totoCZ/45a18acff72ff2b56028037d89f00173 to your computer and use it in GitHub Desktop.
bumps all SOA to trigger update
#!/bin/bash
ts=$(date +%s)
FILES="/var/lib/coredns/zones/*"
for f in $FILES
do
echo "Processing $f file..."
gawk -i inplace '!/hostmaster.hetmer.net/' $f
origin=$(awk 'NR==1{print $1}' $f)
sed -i "1s/^/$origin 3600 IN SOA ananas.ns.hetmer.net. hostmaster.hetmer.net. $ts 21600 3600 864000 3600\n/" $f
done
cd /var/lib/coredns/zones
if [ -n "$(git status --porcelain)" ]; then
git config --add safe.directory /var/lib/coredns/zones
git config user.email "coredns@hetmer.net"
git config user.name "coredns"
git add .
git commit -m "synced on $(date -I) $(date +%T)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment