You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
750 B
32 lines
750 B
#!/usr/bin/sh
|
|
# $1 - save path, default is 'onic-domains' created in working directory
|
|
|
|
onic_zone_path=/var/named/onic
|
|
onic_domains_path="onic-domains"
|
|
|
|
if [ -n "$1" ]; then
|
|
$onic_domains_path=$1
|
|
fi
|
|
|
|
mkdir -p $onic_domains_path
|
|
|
|
for f in $onic_zone_path/*.zone; do
|
|
zone=$(basename $f)
|
|
zone=(${zone//.zone/})
|
|
|
|
echo -n "Processing $zone... "
|
|
|
|
named-compilezone -q -f raw -F text -o /tmp/$zone.text $zone $f
|
|
grep -v "*" /tmp/$zone.text \
|
|
| awk '{ print substr($1, 1, length($1)-1) | "sort -u"; NF > 0; }' \
|
|
> $onic_domains_path/$zone.list
|
|
rm /tmp/$zone.text
|
|
while read domain; do
|
|
if [ -n "$(dig +short $domain)" ]; then
|
|
echo $domain >> $onic_domains_path/$zone.list.active
|
|
fi
|
|
done < $onic_domains_path/$zone.list
|
|
echo "Done"
|
|
done
|
|
|