On Saturday 09 March 2002 20:05, SI Reasoning wrote:
> By the way, how can I get the etc/hosts to update
> automatically whenever the ip address changes? The
> dhcp server is on the same computer as the Xdmcp
> server.

Various ways. This _is_ Unix. (-:

The best/most straightforward is to make DHCPd update your DNS (and put that 
on the same machine if you don't have one). Then you don't need an /etc/hosts 
entry. Read /usr/share/doc/dhcp* 'coz most of those tools will run a script 
for you whenever something like that changes.

Worst comes to worst, copy /etc/resolv.conf to /etc/resolv.conf.template, 
replace your IP address in the template file with the word ADDRESS and run 
this every minute or few (with crond):

    sed </etc/resolv.conf.template >/etc/resolv.conf \
      -e "s/^ADDRESS/$(ifconfig eth0|gawk '-F[ :]+' '/addr:/{print $4}')/"

Cheers; Leon

Reply via email to