Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 21
  1. #1
    cPanel Partner NOC cPanel Partner NOC Badge DWHS.net's Avatar
    Join Date
    Jul 2002
    Location
    LA, Costa RIca
    Posts
    1,356

    Default Anyone know how tochange all the dns to point to a new server at once.

    Manually editing 100's of dns zones does not sound fun.

    Is there a clever way that will do all of them at once.

    Thanks,

    cPanel.net Support Ticket Number:

  2. #2
    Member
    Join Date
    Jun 2003
    Location
    NC, USA
    Posts
    94

    Default

    Well, if its a set text that you are changing. You can easily do a a mass search & replace with a perl expression.

    # perl -pi -e 's,OLDTEXT,NEWTEXT,' *

    That will search thru all files in teh current directory (*) and replace OLDTEXT with NEWTEXT. Maybe that'll help.

    cPanel.net Support Ticket Number:

  3. #3
    cPanel Partner NOC cPanel Partner NOC Badge DWHS.net's Avatar
    Join Date
    Jul 2002
    Location
    LA, Costa RIca
    Posts
    1,356

    Default

    Thanks but I do not know ho to set up perl files.

    Can you show me what the whole perl file would be, what to name it and how does the file know where the named.conf is?



    cPanel.net Support Ticket Number:

  4. #4
    Member
    Join Date
    Jun 2003
    Location
    NC, USA
    Posts
    94

    Default

    That is a command you can run from a shell. If you cannot login to your account using SSH (or putty), then you cannot use this command.

    But if you goto the directory of the file you want to modify, and just type that command

    # perl -pi -e 's,OLD,NEW,' named.conf

    That command will search named.conf for everything 'OLD' and change it to 'NEW'.

    cPanel.net Support Ticket Number:

  5. #5
    cPanel Partner NOC cPanel Partner NOC Badge DWHS.net's Avatar
    Join Date
    Jul 2002
    Location
    LA, Costa RIca
    Posts
    1,356

    Default

    Thanks, I have never ran a perl command from the command line yet.



    cPanel.net Support Ticket Number:

  6. #6
    Member casey's Avatar
    Join Date
    Jan 2003
    Location
    If there is trouble, it will find me
    Posts
    2,336

    Default

    Originally posted by DWHS.net
    Thanks, I have never ran a perl command from the command line yet.




    cPanel.net Support Ticket Number:
    DWHS,

    If that works, could you let me know? I have to do that next week...

    It would actually be run from /var/named , right?
    # perl -pi -e 's,OLDIP,NEWIP,' *

    cPanel.net Support Ticket Number:
    Last edited by casey; 09-14-2003 at 12:01 AM.

  7. #7
    cPanel Partner NOC cPanel Partner NOC Badge DWHS.net's Avatar
    Join Date
    Jul 2002
    Location
    LA, Costa RIca
    Posts
    1,356

    Default

    O.K. I am going to try it tonight.

    cPanel.net Support Ticket Number:

  8. #8
    Member casey's Avatar
    Join Date
    Jan 2003
    Location
    If there is trouble, it will find me
    Posts
    2,336

    Default

    Did everything go smoothly?

    And is this what you ran from /var/named ?
    # perl -pi -e 's,OLDIP,NEWIP,' *

    cPanel.net Support Ticket Number:

  9. #9
    cPanel Partner NOC cPanel Partner NOC Badge DWHS.net's Avatar
    Join Date
    Jul 2002
    Location
    LA, Costa RIca
    Posts
    1,356

    Default

    Actually I have a linguring account that needs more time before I can do it.

    Talk to soon about it.

    cPanel.net Support Ticket Number:

  10. #10
    Member
    Join Date
    Mar 2003
    Posts
    160

    Default

    Hi, the perl -pi command will work but not sure about the *

    I did that not too long ago but did it in stages. IE: replaced the * with the zone name.

    Then after you run the perl -pi command restart named and you will be all good.

    cPanel.net Support Ticket Number:

  11. #11
    Member
    Join Date
    Jun 2003
    Location
    NC, USA
    Posts
    94

    Default

    The * just means it'll search all files in the current directory.

    cPanel.net Support Ticket Number:

  12. #12
    Member Stefaans's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, Canada
    Posts
    445

    Default Nearly there . . .

    Nice solution to search and replace text. But shouldn't one increment each zone serial number as well?

    cPanel.net Support Ticket Number:

  13. #13
    Member
    Join Date
    Jun 2003
    Location
    NC, USA
    Posts
    94

    Default

    I'm no BIND/dns guru, so I'm not sure, sorry.

    cPanel.net Support Ticket Number:

  14. #14
    Member casey's Avatar
    Join Date
    Jan 2003
    Location
    If there is trouble, it will find me
    Posts
    2,336

    Default

    Originally posted by casey
    Did everything go smoothly?

    And is this what you ran from /var/named ?
    # perl -pi -e 's,OLDIP,NEWIP,' *

    cPanel.net Support Ticket Number:
    Well, the time came for mine to be changed, so I did it, and without a hitch. 6 hours before the move, I updated the ttl by doing
    cd /var/named
    perl -pi -e 's,86400,3600,' *

    Then, 6 hours later I moved all the accounts, then ran
    chmod 755 /home/*/public_html
    because the permissions were wrong.

    Then I changed the IPs by doing
    perl -pi -e 's,OLDIP,NEWIP,' *

    Unfortunately, due to my lack of programming abilities, I had to go through the zones one by one after that and increment the serial number by one.

    Worked nicely. Changes were instantaneous if I had not visited the site recently. If I had, it took about 30 minutes for the change to take effect.

    cPanel.net Support Ticket Number:

  15. #15
    Member
    Join Date
    Jun 2003
    Location
    NC, USA
    Posts
    94

    Default

    Good to hear! And I'm sure there's some script or perl expression you could have run to increment that number. I'm no perl guru either. But perl gurus swear you can do anything with perl. Probably could write the next space shuttle with 3 lines of perl code. 1 for lift off, 1 for travel, and 1 for the return trip.

    cPanel.net Support Ticket Number:

Similar Threads & Tags
Similar threads

  1. Access client cPanel when DNS doesnt point to my hosting
    By mumbles27 in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 03-24-2010, 01:27 PM
  2. Wildcard DNS - catch all domains point to server?
    By jeroman8 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 05-14-2008, 02:46 AM
  3. How to point my own domain to my own DNS server
    By server75 in forum New User Questions
    Replies: 15
    Last Post: 04-25-2008, 06:43 PM
  4. How I add domain and point it on flooder + how i do Wildcarded DNS?
    By TopSite.co.il in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-28-2004, 06:45 AM
  5. Edit a DNS Zone to point ALL mail to Exchange server?
    By ThunderHostingDotCom in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-29-2003, 02:05 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube