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.

Linux command

Discussion in 'Data Protection' started by IRCBrasil, Nov 26, 2005.

  1. IRCBrasil

    IRCBrasil Well-Known Member

    Joined:
    Jul 22, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Hi friends,

    I am moving my server to another datacenter, and i would like to change all entrys with 14400 to 3600 for all *db files from /var/named

    Which is the command for it? I tryed find * -name '/var/named/*.db' | xargs perl -pi -e "s/14400/3600/sg;" but i wasnt help with this.

    Thans if someone could help me.
     
  2. Izzee

    Izzee Well-Known Member

    Joined:
    Feb 6, 2004
    Messages:
    469
    Likes Received:
    0
    Trophy Points:
    16
    This from a previous post might help. Original poster, I forget. but he claims any credit or otherwise ;)

    From shell:

    (first, backup all of your files)

    then:

    find /var/named -type f -exec \
    sh -c 'gawk "$0" "$1" > "$1.tmp"; mv "$1.tmp" "$1"' \
    '{gsub("oldvalue","newvalue"); print $0}' '{}' \;


    Just replace oldvalue and newvalue with the appropriate values.

    So, if you wanted to change "expire" from 3600000 to 600 .....

    find /var/named -type f -exec \
    sh -c 'gawk "$0" "$1" > "$1.tmp"; mv "$1.tmp" "$1"' \
    '{gsub("3600000","600"); print $0}' '{}' \;
     
  3. IRCBrasil

    IRCBrasil Well-Known Member

    Joined:
    Jul 22, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6

    Hi Izzee,

    Thanks a lot for your help. I could make the changes, but without the " on the values (may be becouse this is numeric value?) I remenber this rule on university school on algoritm class heheh.

    Anywhay, thanks a lot, this was, in fact, very helpfull fo me.

    Regards,

    André
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    As I've mentioned before, if you modify a zonefile manually you should always increment the serial number after every change, otherwise you can cause problems with propagation.

    There's a script to do that here, though I haven't used it myself:
    http://www.cplicensing.net/files/scripts/updateserial
     
  5. IRCBrasil

    IRCBrasil Well-Known Member

    Joined:
    Jul 22, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    I tryed this scripts but it returned me this:

    root@matrix [/var/named]# perl updateserial
    Can't locate DNS/ZoneParse.pm in @INC (@INC contains: /usr/lib/perl5/5.8.7/i686-linux /usr/lib/perl5/5.8.7 /usr/lib/perl5/site_perl/5.8.7/i686-linux /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .) at updateserial line 9.
    BEGIN failed--compilation aborted at updateserial line 9.
    root@matrix [/var/named]#

    What may be wrong?
     
  6. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    /scripts/perlinstaller DNS::ZoneParse
     
Loading...

Share This Page