test to see if eth0 is active
Ok, heres the deal. I am making a bash script that checks to see if the ip address is in a certain range, and proceeds to backup data to a server. I did this by grepping ifconfig for a certain ip range. However this script is going to be ran on a laptop that will be plugged and unplugged from the network. If you run ifconfig when the laptop isnt plugged in but the nic is turned on, it keeps the ip address from the last time you ran dhcpcd, even though it isn't plugged in at the time.
What I need is a way to tell if the ethernet cable is plugged in or not. Is there a way to do this?
Thanks,
DragonM15
|