Skip to main content

Bulk Change Records

Comments

6 comments

  • Jcats
    This should work:
    # for i in $(ls *.db | sed 's/.db//g') ; do sed -i.bak "s/admin.domain.com/admin.$i/g" $i.db ; done
    but first
    # cp -rf /var/named /var/named.bk
    sed will create a backup of each zone as well but much easier to revert by just replacing the entire folder from the above backup. You also have to increment the serial in each DNS zone by 1.
    # find /var/named/*.db -mtime -1 -exec perl -pi -e 'if (/^\s+(\d{10})\s+;\s+serial/i) { my $i = $1+1; s/$1/$i/;}' '{}' \;
    I haven't tested the above so I would try it out on one zone just too make sure it works then
    # service named reload
    0
  • zohair28
    Many thx for your answer but I got this inside mail value after running command:- admin.$i. So still this is not the correct value, What do you think?
    0
  • zohair28
    It is working now! I changed ' with " for sed command. for i in $(ls *.db | sed 's/.db//g') ; do sed -i.bak "s/admin.domain.com/admin.$i/g" $i.db ; done Many thx again!!
    0
  • Jcats
    Sorry please use:
    # for i in $(ls *.db | sed 's/.db//g') ; do sed -i.bak "s/admin.domain.com/admin.$i/g" $i.db ; done
    0
  • Jcats
    Beat me to it, glad its working :)
    0
  • cPanelMichael
    Hello, I'm happy to see the issue is now resolved. Thank you for updating us with the outcome.
    0

Please sign in to leave a comment.