[ltp] Getting full hostname from DHCP

Tod Harter linux-thinkpad@www.bm-soft.com
Fri, 21 Jun 2002 09:17:53 -0400


On Thursday 20 June 2002 18:03, Edi Weitz wrote:

Well, my answer would be that Gentoo's init subsystem isn't correctly 
structured if its doing network initialization and firing up server processes 
BEFORE it attempts to initialize basic networking functions!

However, in the case of Apache there is to my knowledge no way to tell it 
"use whatever hostname eth0's IP address maps to at startup". In other words 
somewhere in the Apache config is a line, probably

Servername your.machine.name

and thats the name its always going to have. 

> Am I supposed to write a hostname init script that starts after the
> network has been initialized and calls /bin/hostname with a fully
> qualified hostname determined from /etc/resolv.conf, something like
> this:
>
>   #!/bin/sh
>
>   FIRST=`/bin/hostname`
>   REST=`perl -n -e 'print $1 if /^search (.*)/' /etc/resolv.conf`
>   hostname "$FIRST.$REST"
>
> I think that would the trick, but I wonder if this is the correct way
> to do it.
>
> Thanks,
> Edi.
>
> ----- The Linux ThinkPad mailing list -----
> The linux-thinkpad mailing list home page is at:
> http://www.bm-soft.com/~bm/tp_mailing.html

----- The Linux ThinkPad mailing list -----
The linux-thinkpad mailing list home page is at:
http://www.bm-soft.com/~bm/tp_mailing.html