Re: changing hostname
On Fri, Jun 22, 2001 at 02:23:46PM +0200, Joost Kooij wrote:
> On Fri, Jun 22, 2001 at 12:16:51PM +0000, Iain Smith wrote:
> > I'd suggest:
> >
> > find /etc/ -type f |xargs grep $HOSTNAME
>
> Well, that is a really big hammer in fact. And you will still miss
> stuff that is not under /etc, but has a symlink in /etc pointing to it.
Well, I've always been a sucker for the largest and noisiest tool for the
job! :)
> I used to do it like this (or much worse even, involving multiple
> pneumatic hammers in subshells piped to pathologically eclectic chainsaws)
> myself. Sure, it was fun making lots of noise and it even gave me some
> slight of hand at juggling these toys (and parsing yet another manpage
> when the balls keep falling on the floor). :-)
>
> Until I found out about this wonderful "-r" option to gnu grep:
>
> grep -r myregex /etc
>
> wants to be your friend too.
Hmmm.... I managed to miss that one completely. Time to re-rtfm! I knew of
rgrep but found it was rarely available in avg distros... I guess I know why
now!
> > rather than using cat, you'll get the names of any files containing matches
> > back using this method. Also, it may be worth changing the search base to /
> > as IIRC a search on a potato box turned up some matches elsewhere on the
> > filesystem...
>
> Watch out for all the rope hanging about in dark corners of /proc and
> /dev. Your point is valid though, but I doubt that you'll find
> much of importance outside of /var. And then most of what is in /var
> should probably change itself when daemons restart or should just stay
> like it was, like your archived logfiles.
/proc and /dev? Shirley the next reboot would cure /proc... though admittedly
it's not always an option... and an all together too windowsish solution! ;)
Can't think what might hiding in /dev though.
> Your best point above is the most subtle one: try not to hardcode any
> "local" information in scripts, when you can use self-healing constructs
> offered to you by the system, like a $HOSTNAME environment variable, if
> there is one. Or by figuring it from a "$(hostname)" subshell call.
>
> If all the scripts and configuration files could use this (of course that
> is not a reasonable assumption in reality), one would ideally only have
> to change one file, /etc/hostname. But then you grow sick of all the
> stupid dns queries for your own hostname and you fix /etc/hosts. And then
> it turns out that pithy app foo doesn't understand any fancy $whatever
> stuff in its config file. Oh well.
Regards,
Iain
Reply to: