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:
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:
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:
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:
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:
Thanks, I have never ran a perl command from the command line yet.
cPanel.net Support Ticket Number:
DWHS,Originally posted by DWHS.net
Thanks, I have never ran a perl command from the command line yet.
cPanel.net Support Ticket Number:
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.
O.K. I am going to try it tonight.
cPanel.net Support Ticket Number:
Did everything go smoothly?
And is this what you ran from /var/named ?
# perl -pi -e 's,OLDIP,NEWIP,' *
cPanel.net Support Ticket Number:
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:
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:
The * just means it'll search all files in the current directory.
cPanel.net Support Ticket Number:
Nice solution to search and replace text. But shouldn't one increment each zone serial number as well?
cPanel.net Support Ticket Number:
I'm no BIND/dns guru, so I'm not sure, sorry.
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 doingOriginally 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:
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:
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: