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

Re: Detecting Network connections...

Ah, perfect!  This did what I wanted.  Thanks!

For the curious, I added this:

---< snip >---
#! /bin/sh

HAVELINK=$(mii-tool eth0 | grep "no link")

if [ -z "$HAVELINK" ]; then
  echo eth0-link
  echo eth0-nolink

exit 0
---< snip >---

Then I set up a mapping in /etc/network/interfaces for eth0 that called that
script, as well as an iface entry for eth0-link.  (I left out eth0-nolink,
which ifup just ignores with a warning.)

Thanks to everyone for their help!


On Tue, Nov 20, 2001 at 06:33:16AM -0800, David Roundy wrote:
> You could use mii-tool, which when run without arguments returns false if
> there is no wire plugged into the ethernet (or if the other end isn't
> plugged in).  I'm not sure where you would do the checking, though.
> -- 
> David Roundy
> http://civet.berkeley.edu/droundy/
Andrew Davenport                   | All good gifts around us
adavenpo@tropnevad.org             |     are sent from Heaven above.
http://www.tropnevad.org/~adavenpo | Then thank the Lord! Thank the Lord
103 Cluff Crossing Road, Apt. X-8  |     for all his love!
Salem, NH  03079                   | (Chorus of All Good Gifts, from GodSpell)

Reply to: