2007-03-28, 09:44(-08), CptDondo:
> I have a machine that travels. I want to configure it differently when
> it is attached to a local network and when it is not.
>
> So...
>
> Is there an easy way to test if ethX (eth1 in my case) has received an
> IP address via DHCP?
>
> What I want is something like this:
>
> Try to get a DHCP address
> If you succeed, do the following
> copy network database config file to our config
> If you fail, do the following
> copy local database config file to our config
> start local mysqld
>
> Nothing too complex.... But I can't seem to find a reliable test for the
> DHCP assignment.
[...]
I would use dhclient-script hooks. See:
man dhclient-script
--
Stéphane
|