setting env vars

David A. Bandel david
Mon May 17 11:44:17 PDT 2004


On Mon, 10 Feb 2003 12:36:57 -0500 (EST)
Net Llama! <netllama at linux-sxs.org> wrote:

[snip]

> > To answer your question, though, it is possible during boot to
> > modify the contents of system reference files (/etc/hosts,
> > /etc/resolv.conf, etc.).  DHCPCD changes /etc/resolv.conf for one.
> 
> What i'm trying to do is put something like this in (for example)
> /etc/hosts:
> $IPADDR		$HOSTNAME
> 
> and then set $IPADDR=192.168.0.3 and $HOSTNAME=foo.bar.com
> 
> is this possible?

Sure, you can put that just like you have it.  But it won't work, and
will cause you all kinds of trouble.

Remember all those daemons running on your system?  Some of them need
the information provided by these files and these daemons have no
"environment".  So where will they get the right info from?

Since the info doesn't change, I suggest you get the address and name
during bootup and put the correct info in the file.

Using DHCP?  OK, after you have initialized the interface and obtained
an answer from dhcp, run a script against the output of ifconfig.  Then
run a DNS query against the IP to get the hostname and put all that into
/etc/hosts.  After all, this info shouldn't normally be dynamic between
reboots (or is this a laptop that's never shut off?).

Ciao,

David A. Bandel
-- 
Focus on the dream, not the competition.
		Nemesis Racing Team motto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.linux-sxs.org/pipermail/linux-users/attachments/20030210/f980c74b/attachment.pgp


More information about the Linux-users mailing list