Skip to content

Instantly share code, notes, and snippets.

@fernandokosh
Last active December 10, 2015 18:58
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 fernandokosh/4478679 to your computer and use it in GitHub Desktop.
Save fernandokosh/4478679 to your computer and use it in GitHub Desktop.
Simple script to check in DNS if a domain belongs to my server.
#!/bin/bash
### DNS server to check in whois result
server="ns1.mydomain.com"
### If will get by ls in folder
zones="/var/cache/bind/"
### One per line
zone_list="/var/cache/bind/domains.txt"
### Comment to use ls based
for domain in `cat $zone_list`
### Uncomment to use file list
#for domain in `ls $zones`
do
echo -n "Check whois info for $domain..."
if [ `whois $domain |grep -c -i $server` -gt 0 ]
then
echo ' OK'
else
echo ' Error';
fi
sleep 30
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment