I am currently writing a bash script (for Nagios), and I would like to be able to detect if specific network cards are up or not.
My best guess is to do something like this:
ifconfig eth0 | grep UP | wc -l
ethtool eth0 | grep "Link detected: yes" | wc -l
Are either/both of those reliable ways of testing if the network card is up, or is there a better option? Perhaps there is a flag on
ethtool which will do precisely what I want?