[Gllug] $HOSTNAME

Hari Sekhon hpsekhon at googlemail.com
Wed Sep 9 08:29:26 UTC 2009


Richard Jones wrote:
> On Tue, Sep 08, 2009 at 06:47:40PM +0100, John G Walker wrote:
>   
>> On Tue, 08 Sep 2009 17:05:24 +0100 Peter Cannon
>> <peter at cannon-linux.co.uk> wrote:
>>
>>     
>>> John G Walker wrote:
>>>       
>>>> I think I'm going off my head.
>>>>
>>>> Where is the $HOSTNAME variable set in OpenSUSE 10.1, using KDE3?
>>>> Surely it's set from etc/HOSTNAME? Except they're suddenly
>>>> different.
>>>>
>>>> It's important because it's used in various scripts of mine
>>>> (including the backup),
>>>>
>>>>         
>>> /etc/HOSTNAME
>>>
>>>       
>> That what I thought (see above) but it isn't. It's using a different
>> value to the one on etc/HOSTNAME,
>>     
>
> Older Debian systems had it in /etc/hostname (NB lowercase).
>
> I've also seen systems where this comes from a "special" entry in
> /etc/hosts.  It seems like the second line of /etc/hosts had the form:
>
> <eth0-addr>  hostname.example.com hostname
>
> and the hostname came from that.
>   
I've also observed these differences, an unfortunate lack of consistency 
among distributions, it's usually due to distro-specific bash scripts at 
boot time setting the hostname from these different sources. However, 
they all end up doing the same thing with regards to sourcing from proc 
for hostname -s, at least this is the case on CentOS and Debian that 
I've confirmed.

-h

-- 
Hari Sekhon
http://www.linkedin.com/in/harisekhon

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list