Hello
I would like to create a script that saves all domains and their IPs to the file in the format like this:
1.2.3.4 domain1.com
1.2.3.4 domain2.com
2.3.4.1 domain3.com
1.2.3.4 www.domain1.com
2.3.4.1 www.domain3.com
where 1.2.3.4 and 2.3.4.1 are the IPs associated to the server. My goal is to create list of all A record with domain, and www.domain as the name and save it on some file like hosts.txt. this is because I want to have an easy way to copy and paste these ips onto local hosts file to test if sites works after migration, however my bash skills are limited and I don't know where to start
I think that the best option would be to list all *.db files in /var/named, cut the .db extension and save the result as variable like $domain and then loop in each .db file to find $domain and get the ip from A field then pipng that on the separate file as $IP $domain and lastly do the same again this time adding www. at the beginning of $domain. Can someone point me where to start or maybe someone will want to make that for me - for fee ofcourse. If I can hire someone to do that for me it will be nice.
I would like to create a script that saves all domains and their IPs to the file in the format like this:
1.2.3.4 domain1.com
1.2.3.4 domain2.com
2.3.4.1 domain3.com
1.2.3.4 www.domain1.com
2.3.4.1 www.domain3.com
where 1.2.3.4 and 2.3.4.1 are the IPs associated to the server. My goal is to create list of all A record with domain, and www.domain as the name and save it on some file like hosts.txt. this is because I want to have an easy way to copy and paste these ips onto local hosts file to test if sites works after migration, however my bash skills are limited and I don't know where to start
I think that the best option would be to list all *.db files in /var/named, cut the .db extension and save the result as variable like $domain and then loop in each .db file to find $domain and get the ip from A field then pipng that on the separate file as $IP $domain and lastly do the same again this time adding www. at the beginning of $domain. Can someone point me where to start or maybe someone will want to make that for me - for fee ofcourse. If I can hire someone to do that for me it will be nice.