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.

Remove MX from DNS zone

Discussion in 'Bind / DNS / Nameserver Issues' started by cesarlwh, Nov 21, 2009.

  1. cesarlwh

    cesarlwh Well-Known Member

    Joined:
    Sep 23, 2008
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    Hello, i need a command(to run on command line) to remove all MX entries from a specific DNS zone file.

    Somebody can help me?
     
  2. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    Copy the domain names in a file from which you want to remove the MX records say,

    the domains are
    abc.com
    xyz.com

    place these domains in a file called /var/named/removemx. Once done, execute the following command and it will remove the MX records

    for i in `cat /var/named/removemx`; do sed -i '/MX/d' $i.db; done;

    Once done, restart the named service

    service named restart
     
  3. cesarlwh

    cesarlwh Well-Known Member

    Joined:
    Sep 23, 2008
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    This work!

    Very thanks!!
     
  4. cesarlwh

    cesarlwh Well-Known Member

    Joined:
    Sep 23, 2008
    Messages:
    61
    Likes Received:
    0
    Trophy Points:
    6
    how to make this using PERL language?
     
Loading...

Share This Page