Lan Barnes wrote:
Some time ago I asked about how to send myself email when Cox changes my
IP address. With help from the list, I came up with this, which works
through testing (but hasn't yet been tested by Cox).
Not a daemon, really. I use cron to run it every 10 minutes.
Alternatively, if you're using dhclient to snarf an address, you can add
something like the following to /etc/dhclient-exit-hooks:
if [ -n "${new_ip_address}" ] && [ -n "${old_ip_address}" ]; then
if [ "${new_ip_address}" != "${old_ip_address}" ]; then
# ip address has changed, do whatever
fi
fi
This way, it runs whenever the lease is renewed. I also use this file to
generate a proper /etc/hosts on machines which have dynamic IPs. Red
Hat, at least (and this pisses me off to no end) defaults to something
like the following in /etc/hosts:
127.0.0.1 localhost localhost.localdomain somebox somebox.somedomain.com
I make it something like this:
127.0.0.1 localhost localhost.localdomain
1.2.3.4 somebox somebox.somedomain.com
... it then concatenates the contents of /etc/hosts.in, so you can keep
static entries in your file :)
Cheers,
-Kelsey
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list