LinuxSA Mailing list archives
Index:
[thread]
[date]
[subject]
[author]
[stats]
From: Alan Kennington <akenning@topology.org>
To : LinuxSA <linuxsa@linuxsa.org.au>
Date: Fri, 27 Jul 2001 22:20:46 +0930
Re: Hostname
On Fri, Jul 27, 2001 at 10:14:57PM +0930, Dave Fitch wrote:
> On Sat, Jul 28, 2001 at 12:00:04PM +0930, Andrew Williss wrote:
> > Hi list,
> > what file, sets the hostname and domainame of the machine on BOOT?
> > I thought my /etc/hosts would do this but it doesn't...
> > I have to manually set my hostname ie
> > root@pikachiu root$ hostname [myhostname]
> > why is this so?
>
> it depends on your distribution (they're all different!).
> To find the right place to set it find where it's getting
> set at boot time. Do a 'grep -i hostname /etc/init.d/*'
> (or make that under /etc/rc.d for deadrat/redhat etc)
>
Dave,
Here's a partial answer...
========================================================
I just checked out my old RH 5.2 system, and it has a
line like this in /etc/inittab:
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
And if you look at rc.sysinit, you see all of the
defaults etc. for setting up the hostname at
boot time.
E.g. my old RH5.2 system has this in rc.sysinit:
if [ -f /etc/sysconfig/network ]; then
. /etc/sysconfig/network
else
NETWORKING=no
HOSTNAME=localhost
fi
and then this:
if [ ! -f /etc/HOSTNAME ]; then
echo ${HOSTNAME} > /etc/HOSTNAME
fi
and so forth.
And the file /etc/sysconfig/network has this:
HOSTNAME=rat
========================================
My SuSE 7.1 system has this in /etc/inittab:
# check system on startup
# first script to be executed if not booting in emergency (-b) mode
si:I:bootwait:/etc/init.d/boot
And the file /etc/init.d/boot has this:
. /etc/rc.config
and later this:
# set hostname and domainname
#
test -n "$FQHOSTNAME" && {
echo -n Setting up hostname
hostname ${FQHOSTNAME%%.*}
rc_status -v -r
}
So in the SuSE case, the host name really comes from the
system configuration file.
=========================================
Hmmm. So that means that the hostname in both cases comes from
a configuration file.
And it just gets _written_ to /etc/HOSTNAME.
Cheers,
Alan Kennington.
--
LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject
Index:
[thread]
[date]
[subject]
[author]
[stats]
Return to the LinuxSA Mailing List Information Page