I've heard mention that the ifup scripts will be run when DHCP updates the
dynamic address, but I have never checked.  If it does that might be a good
place to put the code.  Otherwise using grep/awk on the ifconfig output and
then comparing that to a file would work.  If the IP is not the same, update
hosts, and then update the file you are comparing against.

On Sat, Apr 11, 2009 at 9:18 AM, Chris Penn <[email protected]> wrote:

> This isn't a smart thing to do, but I want to know if I can do it.
> I have a server that has a public IP address, but it is not static.
> Im trying to think of a way to update the /etc/hosts file when this Ip
> changes.
> It does change often, but it does change from time to time, since this
> machine is IP is technically labeled as a workstation.
> I realize that when it changes I will need to reset certain services.......
>
> Does anyone have any ideas?  I can write the ip address to a file, but
> can I get /etc/hosts to read from that file?
> I think that is a way to do it, but I'm not sure.  Do I need to
> install bind?  I need to man hosts more.....
>
> chris...
>
> --
> "As we open our newspapers or watch our television screens, we seem to
> be continually assaulted by the fruits of Mankind's stupidity."
>  -Roger Penrose
> _______________________________________________
> LinuxUsers mailing list
> [email protected]
> http://socallinux.org/cgi-bin/mailman/listinfo/linuxusers
>



-- 
Peter Manis
(678) 269-7979

Reply via email to