The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

/scripts/rebuildnamedconf

Discussion in 'General Discussion' started by jdhf99, Nov 27, 2008.

  1. jdhf99

    jdhf99 Well-Known Member

    Joined:
    Mar 16, 2004
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Is there anyway to have this output the new named.conf to something besides named.conf? I have about 31,000 zones and it takes 2-3 hours to rebuild. During the rebuild named no longer functions on the server. It would be great if I could have it rebuild to something like named.new.conf then just swap it out once it's done.

    Is there any option for this?

    Thanks
     
  2. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    The script should be human readable, so you should be able to replace the /etc/named.conf references with a temp file, and then put it back afterwards
     
  3. jdhf99

    jdhf99 Well-Known Member

    Joined:
    Mar 16, 2004
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    I did try that... it looks like it built 'one of the views'. I'm not really up to date on my named stuff, I just know a year ago it started making the named file with multiple views. When I changed the fixnamedconf and fixrndc scripts to use named.new.conf it only built one view. When I replaced the named.conf with the newly generayed named.new.conf (half the size) my messages log was spammed with all the zones saying they're not authoritative.
     
  4. wahb

    wahb Registered

    Joined:
    Nov 27, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    just edit it !
    PHP:
    nano /scripts/rebuildnamedconf
     
  5. stdout

    stdout Well-Known Member

    Joined:
    Apr 10, 2003
    Messages:
    189
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Nelspruit, Mpumalanga, South Africa
    cPanel Access Level:
    Root Administrator
    Copy /scripts/rebuildnamedconf to /scripts/rebuildnamedconf2
    eg. cp -fp /scripts/rebuildnamedconf /scripts/rebuildnamedconf2

    Modify line 50 in /scripts/rebuildnamedconf2, changing the /etc/named.conf path to /etc/named.conf.new
    Touch /etc/named.conf.new - eg. touch /etc/named.conf.new

    Execute the command:
    "/scripts/rebuildnamedconf2; cp -fp /etc/named.conf /etc/named.conf.orig; mv /etc/named.conf.new /etc/named.conf"

    The command will:
    * generate a new named.conf (named.conf.new)
    * copy the original named.conf to named.conf.orig
    * rename /etc/named.conf.new to /etc/named.conf
     
  6. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    Just curious if you tested this?

    When I first read this post I thought the same thing, so before I posted I did just what you said.

    cp the script to /scripts/rebuildnamedconfnew, changed line 50 to read named.conf.new cp the /etc/named.conf to /etc/named.conf.new then ran /scripts/rebuildnamedconfnew and it still only updated the /etc/named.conf so I figured there was something in the include file.

    Just curious if I missed something or if something untested was assumed and posted.
     
  7. sirotex

    sirotex Well-Known Member

    Joined:
    Jul 10, 2008
    Messages:
    121
    Likes Received:
    0
    Trophy Points:
    16
    Wow... re-read what was said, it isn't brain surgery. Why would you pico /scripts/rebuildnamedconfnew to change /etc/named.conf to /etc/named.conf.new then cp /etc/named.conf to /etc/named.conf.new? The whole point is that the script rebuilds in /etc/named.conf.new So you can cp named.conf.new to named.conf once it finishes...
     
  8. stdout

    stdout Well-Known Member

    Joined:
    Apr 10, 2003
    Messages:
    189
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Nelspruit, Mpumalanga, South Africa
    cPanel Access Level:
    Root Administrator
    It was just an untested assumption. Looks like even renaming line 44 and commenting out from lins 45 - 58 makes no difference either. Here's a workaround though.

    Simply copy/paste this into your CLI:
    Code:
    cd /var/cpanel/users; grep DNS * | cut -d= -f2 | awk {'print "zone \""$1"\" { type master; file \"/var/named/"$1".db\"; };"'}
    You want to pipe the output to a file and include it in named.conf, or just append it to the existing (empty named.conf). It should be alot less CPU usage and alot faster.

    * It only generates the zone lines - you'll want the original "top section" of named.conf where the settings are kept as well as the first 1-3 relevant local dns zones.
     
    rhenderson likes this.
  9. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    Your right it is not brain surgery. No need to re-read I know what was stated. And then again if you wanted to post something useful why dont you instead of acting offended or something.

    You have to either cp the named.conf to the new name or touch the new named file, it needs to exist, because on line 50 it is looking for the file to determine if it is *nix of BSD if it cannot find it, it wil error out and not run. I choose to cp the original fie so I can compare sizes and time stamps, but to each his own on that. The other point I was making is that is not where the named.conf output name comes from.

    Very nice!! Thanks for that. I was just curious because initailly I made the same assumption. I added a positive reputation to you for the post.
     
    #9 rhenderson, Nov 27, 2008
    Last edited: Nov 27, 2008
  10. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    /scripts/rebuildnamedconf has long been deprecated. In 11.24 the functionality is replaced by /scripts/rebuilddnsconfig which is more reliable than the older script.

    The new script uses a temporary file, rather than updating named.conf in place. At the end, it then overwrites named.conf with the new one.
     
  11. rhenderson

    rhenderson Well-Known Member

    Joined:
    Apr 21, 2005
    Messages:
    785
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Oklahoma
    cPanel Access Level:
    Root Administrator
    Nice to know, so it would seem that jdhf99 should update to 11.24.
     
  12. xphost

    xphost Well-Known Member

    Joined:
    Nov 12, 2003
    Messages:
    76
    Likes Received:
    0
    Trophy Points:
    6
    Thank you, its work!
     
  13. Kasper

    Kasper Active Member

    Joined:
    Aug 26, 2004
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chicago
    Actually it updates the existing named.conf if you run /scripts/rebuilddnsconfig and even if you specify

    $def_namedconf = '/etc/namedb/named.conf.whatever';

    on clearcache() sub it still pushes updates to /etc/named.conf

    So, if you change it to another one, the cached entries don't get added
    If you don't change it, it updates the file /etc/named.conf directly

    Using
    cpanel-dnsonly(Update for Tue Jan 20 17:03:59 2009)
     
Loading...

Share This Page