LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-28-2005, 03:04 AM   #1
six6
Member
 
Registered: Jun 2004
Location: In Adamantine Chains and penal Fire
Distribution: Debian Sarge & Ubuntu Breezy
Posts: 107

Rep: Reputation: 16
howto test if an ethernet device is active


In a bash script. What would be a good way? My netcard always disconnects (prism54, the developers know about this issue and are working on it) so I need a script to periodically "see" if the connection is active or not, and if not, reinitialize it.

Something to the tune of

#!/bin/bash

declare IF_STATE=`<some command>`
if [ "$IF_STATE" = "on" ]; then
exit
else
ifdown --force eth0
ifup --force eth0
exit
fi

So what would I use for the command? I though of `ifconfig eth0 | grep BROADCAST` and that should have the word "UP" on that line if eth0 is actually UP, but this method is ugly.

Do you have a better way?
 
Old 01-28-2005, 03:39 AM   #2
six6
Member
 
Registered: Jun 2004
Location: In Adamantine Chains and penal Fire
Distribution: Debian Sarge & Ubuntu Breezy
Posts: 107

Original Poster
Rep: Reputation: 16
duh... I guess I could just use "netstat -i"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HOWTO: MS Active Directory with BIND on Linux ghight Linux - Networking 12 10-27-2012 05:58 AM
Online, Ethernet active, but Mozilla won't take me anywhere? JWHolloway Linux - Networking 7 01-21-2005 03:51 PM
ethernet active, but no access to internet nouwen Linux - Newbie 3 06-14-2004 01:38 PM
Can't Bring Ethernet Up / Can't Active Ethernet / Guigo Linux - Newbie 8 04-03-2004 09:31 AM
Active ethernet card, no connection toegrim Linux - Networking 1 10-15-2003 04:55 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration