LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 08-17-2004, 09:41 AM   #1
untoldone
LQ Newbie
 
Registered: Nov 2003
Location: near DC, USA
Distribution: Slackware 9.1
Posts: 14

Rep: Reputation: 0
changing SOAs in named with large numbers of zone files


Hi, I have a DNS server running on my redhat ES2.1 box with lots of zone files. I recently decided to change the expire and minimum time limits on all of the files. I was wondering if there’s a better way to change the 400 files or so other then going through each file and individually changing every record. Thanks for your time.
 
Old 08-17-2004, 10:17 AM   #2
Technoslave
Member
 
Registered: Dec 2003
Location: Northern VA
Posts: 493

Rep: Reputation: 30
Well, if all your files are uniform, such as my expire is set to 604800 and my minimum is set to 38400, these are all unique numbers within each file, you could do a sed to change them.

Something like this:

#!/bin/sh

for i in `ls *.net`
do
sed -e 's/604800/666666/' \
-e 's/38400/33333/' $i > blah.tmp

mv blah.tmp $i
done

If they're not all uniform, then you can do something with head and tail and some echos...but hopefully the simple sed script will work for you.
 
Old 08-17-2004, 12:45 PM   #3
untoldone
LQ Newbie
 
Registered: Nov 2003
Location: near DC, USA
Distribution: Slackware 9.1
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks much. Thats exactly what i was looking for.
 
Old 08-17-2004, 03:35 PM   #4
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
A quick one-liner in Perl:
perl -pi -e 's/oldpattern/newpattern/g' zone*

This will modify them in place so make a backup copy of the files before you do this.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS: Named.conf don point to zone file Swakoo Linux - General 3 09-27-2005 08:02 PM
named classless reverse zone jon3k Linux - Software 1 03-08-2005 10:57 PM
Problems with iptables and DNS/named Zone settings majiclab Linux - Networking 2 10-24-2004 06:27 AM
Bind/named can't open zone files for some reason adam_lang Linux - Networking 2 02-02-2004 10:09 PM
Changing time zone... tinaa Linux - General 3 07-11-2003 07:07 AM


All times are GMT -5. The time now is 02:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration