|
Home > Archive > Unix administration > September 2005 > cloning system
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| cconnell_1@lycos.com 2005-09-29, 6:00 pm |
| Hello,
I have cloned a solaris system running a proxy application (restored
from backup) to another one so that all config files etc are the same.
I need to change the hostname and ip of the system
The hostname and ip appear in a lot of configuration files. I want to
do a find so I can see all the files which contain them to change to
the new hostname/ip.
Currently I do a
grep -l "<hostname>" `find .` 2> /dev/null
>From the root dir, which will give me the file the string <hostname>
appears in.
However this takes ages and will search through binary files which I do
not want to do, is there a quicker way, or a way to sepcify find to
search ascii or text files only?
Thanks very much
| |
|
| cconnell_1@lycos.com wrote:
> Hello,
> I have cloned a solaris system running a proxy application (restored
> from backup) to another one so that all config files etc are the same.
> I need to change the hostname and ip of the system
>
> The hostname and ip appear in a lot of configuration files. I want to
> do a find so I can see all the files which contain them to change to
> the new hostname/ip.
>
> Currently I do a
>
> grep -l "<hostname>" `find .` 2> /dev/null
>
> appears in.
>
> However this takes ages and will search through binary files which I do
> not want to do, is there a quicker way, or a way to sepcify find to
> search ascii or text files only?
>
> Thanks very much
>
The only way your going to avoid frivolously grepping is to narrow your
search somehow, either to a certain filename pattern, perhaps, or to
specific (sub)directories.
If you're just trying change the hostname you can comb through and
manually change the hostname in following files and reboot:
/etc/hosts
/etc/hostname.<if#>
/etc/net/*/hosts
/etc/nodename
'sys-unconfig' will change all that automatically; you'll reconfigure
the host setup from scratch, hostname, naming services, etc. after
rebooting. See the manpage before doing that.
Your app(s) will need to know about the change, most likely. Also, this
find will do what you were trying above a little more efficiently ...
find . -type f -exec grep -q <your-hostname-or-other-pattern-here> {} \;
-print
|
|
|
|
|