[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Running services if and only if network exists



I have a Dell Latitude C600 running unstable.  This is largely
irrelevant.  The important detail is that it has a built-in 802.11
wireless Ethernet card, but not all of the world has wireless, so I
also have a separate 100base-T Ethernet card.  Assuming I'm being
competent, exactly one of these will be working at a time.

There are a couple of services that become unhappy if you start them
before there's network.  The more common one is ntpd; it starts
happily without network, but will never sync if the time is
sufficiently far off, and you can't run ntpdate after ntpd comes up.
(The less common one is zhm, from MIT's Zephyr instant-messaging
system, which just won't start if it can't reach the Zephyr servers.)

One obvious way to work around this is to drop scripts into
/etc/network/if-{up,down}.d that start and stop things.  But this
leads to problems:

  1. Boot; pcmcia-cs starts wireless card on eth0
     A. zhm and ntpd start
  2. Insert 100base-T card; pcmcia starts on eth1
     B. zhm and ntpd start (hopefully nop's)
  3. 'cardctl eject' to get rid of wireless card
     C. zhm and ntpd stop (wrong!)

This can be hacked around by adding logic to determine if network
actually exists.  One criterion that's been suggested to me is to
check to see whether a default route exists, and if so, if the gateway
machine is reachable; if so, the network exists.  This feels a little
klunky to implement by hand, though.

So, the big question: there are five or six different laptop network
configuration packages out there.  Do any of them deal adequately with
this case?

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: