in reply to DNS Failover
You should escape the dots . in your regex: s/192\.168\.10/10.2.5/g. Otherwise the . stands for any character, which is probably not what you want.
There is a different solution, that may clean up your process of rewriting the configuration files: you could store all the real data in a template file, and write a placeholder instead of the parts that are changed on failover (i.e [%root_ip%].23 instead of 192.168.10.23 or 10.2.5.23).
Then every time you'd normally change the config files directly you now modify only the templates.
And you need a script that processes the templates, and substitutes the variables based on whether you're in failover mode or normal operation.
CPAN has many templating modules ready for you, like Template and Text::Template.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DNS Failover
by bjensen34 (Initiate) on Oct 29, 2007 at 22:37 UTC | |
by moritz (Cardinal) on Oct 29, 2007 at 22:47 UTC | |
by bjensen34 (Initiate) on Oct 29, 2007 at 22:56 UTC |