How to add a new dns record to all existing domains and pointer zones

This guide contains a script which goes through all domains and domain pointers, and will add a new A record with a specific value you want, using that User's existing IP address.

Replace mynewrecord with the value that you want. Adjust the /var/named path if you're running FreeBSD or Debian. Don't forget to restart named after running the script.

#!/bin/sh
DATAU=/usr/local/directadmin/data/users
for u in `ls $DATAU`; do
{
   IP=`grep ip= $DATAU/$u/user.conf | cut -d= -f2`
   for d in `cat $DATAU/$u/domains.list $DATAU/$u/domains/*.pointers 2>/dev/null | cut -d= -f1`; do
   {
     echo "adding new record with IP $IP to $d";
     echo "mynewrecord 14400 IN A $IP" >> /var/named/${d}.db
   };
   done;
};
done;
exit 0;
 
dns/add.txt · Last modified: 2010/02/22 09:14 by muscardin
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Please visit Automatic Backlinks to start earning free backlinks Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki