linuxnetwork-programming3g-network

What is the best way to check a 3g router is up and running?


I have a situation where I need to write an application to monitor that a 3g router is up and running, as sometimes the 3g connection isn't stable. I have to ensure the bandwidth usage doesn't go over the limit.

I am not sure what is the best way to monitor the 3g connection status with the minimum usage of the bandwidth of the 3g connection. Any good suggestion?


Solution

  • If ping is not blocked, you can simply do ping -c 10 8.8.8.8 | grep -oE "[0-9]* received" | sed "s/ received//g". If the connection is up, you should get nonzero (>7 for any reasonably good connection) value.