Last active
August 29, 2015 14:26
-
-
Save gb-swatanabe/3a569897ca3ebc0c9b36 to your computer and use it in GitHub Desktop.
DNSゾーンファイルの取得(一括モードあり)
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 | |
# usage: $0 <zone> <server> | |
zone=$1 | |
server=$2 | |
if [ "$zone" = "--all" ];then | |
echo "** DUMP MODE **" >&2 | |
for z in $(awk -F\" '/^zone/{print $2}' /etc/bind/named.conf.local) | |
do | |
echo " - $z" >&2 | |
$0 $z $server | |
done | |
else | |
mkdir -p $server | |
dig @$server axfr $zone | sort > $server/$zone.zone | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
--all
を指定した場合は、/etc/bind/named.conf.local
を参照し全て一括で取得する