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

How to detect network offline and execute script



I know this is something I have seen somewhere (and it is probably something 
right in front of my eyes). But I have just setup a cable modem that uses 
dhclient to grab it's IP. Every once in a while the cable modem will flake out 
and then it is unusable - until I sit down and either physically reboot it, or 
(I've figured this out) release the IP and drop the NIC then reconnect the 
card and the dhclient.

What I want is a script I can run as a cron job (every 15 minutes or so) that 
will check to see if the network is usable or not. If the modem has flaked out 
on me, it will bring it down and then keep trying to bring it up until it 
succeeds. (Oh and it would be nice to have it send me a little email telling 
me what it did - that's not asking too much is it? :).

Like I said, I know this has got to be somewhere, but I can't find it. Can 
someone point to where it is laid out for me or maybe put together a little 
script fragment that will do the checking for me?

Thanks,
David

--
The Morris Family
David, Lori, Sarah, Emily and Anna
--




Reply to: