Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Jul 2004
    Posts
    95

    Default mass change on all dns zones.

    Hi,

    I have this situation: I need a mass change on all dns zones. All lines equal this:

    domain.com. 3600 IN TXT "v=spf1 a mx ptr ip4:11.22.33.44 a:ns1.domain.com a:ns2.domain.com -all"

    need be changed to:

    domain.com. 3600 IN TXT "v=spf1 a mx ptr ip4:55.66.77.88 a:ns1.domain.com a:ns2.domain.com -all"

    Some sugestion?

    Since now, tanks for any help.

  2. #2
    Member freedog96150's Avatar
    Join Date
    Mar 2005
    Location
    Nevada, USA
    Posts
    68

    Default

    A very quick and crude way to make bulk changes in RH based systems is to use the replace command. You can find help for the replace command by typing
    Code:
    replace -v
    at the prompt. Here is a sample command to change your files in one swoop. Keep in mind that this command is indiscriminate, so it will replace ALL instances of the match with the replacement.
    Code:
    [root@mybox ~]# replace ip4:11.22.33.44 ip4:55.66.77.88 -- /dir/with/files/*
    If your distro does not have replace, then use my personal favorite utility - sed. This is not as hard are most people think and is very powerful (well beyond my simple example below). There is plenty of help on the web at your fingertips with a simple google search. So now to the nitty-gritty:

    Code:
    [root@mybox ~]# sed -e 's/ip4:11.22.33.44/ip4:55.66.77.88/g' /dir/with/files/*
    Simply put this scripts tell sed to '(s)ubstitute/this string/with this string/(g)lobally' in these files

    Hope this helps. Be careful and remember that it is always a good idea to make a copy of the files to a new directory and experiment on the copy first. Once the desired results are achieved, then replace your working copies.

  3. #3
    Member
    Join Date
    Jul 2004
    Posts
    95

    Default

    Its work!!

    Thanks a lot freedog

  4. #4
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    When updating zone files, the serial number should be updated as well.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  5. #5
    Member
    Join Date
    Jul 2004
    Posts
    95

    Default

    thanks for remind about this, I will use this script http://www.cplicensing.net/scripts.p...e=updateserial

    Just another question, should I do it on /var/named/ , /var/named/chroot/var/named/ , or both dirs ?

    thanks.

  6. #6
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    My servers don't have the 2nd one, but if they both contain zone files, it's probably best to update both.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

Similar Threads & Tags
Similar threads

  1. mass change NS in all zones
    By dragon2611 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-01-2010, 09:13 AM
  2. Mass DNS change - increment serial required?
    By verdon in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 10-02-2006, 12:19 PM
  3. Mass Edit DNS Zones
    By maxihost2 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-13-2005, 09:25 AM
  4. Mass Update DNS Zones After Move?
    By heavenly in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-04-2004, 04:37 PM
  5. Mass DNS entry change?
    By tmellon in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-25-2004, 05:54 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube