crazyaboutlinux

Well-Known Member
Nov 3, 2007
939
1
66
I want to create "A" entry for 450 subdomains is there any utility/script to create "A" entry for all subdomains at one go, server is same only subdomains will be different ?

subdomain1 IN A 123.2.33.45.
subdomain2 IN A 123.2.33.46.
 

madaboutlinux

Well-Known Member
Jan 24, 2005
1,051
2
168
Earth
Copy sub-domain names in a single file (one name per line) for example, create a file /root/subdomain and add sub-domains

abc
xyz
qaz
wsx

Save the file and execute the following script

for i in `cat /root/subdomains`; do echo "$i IN A xx.xx.xx.xx" >> /var/named/yourdomain.tld.db; done;
where,
xx.xx.xx.xx is the IP you want to point the sub-domains to.
yourdomain.tld is the domain on which you want to set the sub-domains.

Don't forget to restart the 'named' service.