Thank you very much for your bash script. I had done something similar early on. My script checked for a ppp0 stanza using ifconfig. I think your script is more efficient…
But, here’s the problem: the Nova tries to hide the fact that it doesn’t have a connection so the ppp0 network interface doesn’t get torn down, possibly for a very long time.
If you’re skeptical, here’s the experiment I have conducted (I just did it again to be sure)…
You’ll need a way to be able to reduce the signal strength to/from the Nova on demand. I did this by making a poor-man’s “Faraday Cage” using aluminum foil. My Nova is in a 3D-printed case I made. The case also includes a u.fl-to-SMA adapter cable, so the SMA connector sticks out of the case at one end (and the USB connector sticks out the other end). I have attached a very short (2") SMA antenna.
By wrapping the case in numerous layers of aluminum foil, coupled with the poor performance of the 2" antenna, I can weaken the signal to the point where my server is no longer receiving any data from the Nova. Furthermore, I can slide the case into the foil, to get the device to stop sending, and also slide it out to strengthen the signal and regain connectivity.
Okay, here’s the experiment:
establish a connection from the Nova to the server and watch data come in (in my case the data are GPS location packets every 30 seconds)
run your bash script (“ip link show ppp0”) on the device with the Nova and observer that ppp0 is UP.
slide the Nova into the Faraday cage and note that data is no longer arriving at the server. Wait for a few minutes to be sure no data is arriving. (My device, attached to the Nova, displays console messages when it sends location packets, and it continues to show these messages while no data is arriving at the server)
run your script (“ip link show ppp0”) and observe that it still indicates that ppp0 is UP, long after data stopped arriving at the server.
slide the Nova back out of the Faraday cage and observe that, suddenly, a bunch of location packets arrive at the server and continue to arrive (every 30 secs in my case).
run your script again and see that ppp0 is UP.
Interpretation of Results
- the Nova lost connectivity while in the Faraday cage
- the shell script never detected that connectivity was lost
- the Nova cached the data packets it was asked to send during the period where it didn’t have connectivity. (So, it must have known it lost connectivity.)
- when the Nova regained connectivity it sent the cached packets
I’ll add that in a separate experiment, where I power off the Nova while it has cached packets, those packets are lost. That is, when the Nova is powered up and connected it does not send the previously cached packets.
The shell script you offered, like the one I wrote in past, does not reliably detect whether or not there is ppp connectivity. With respect to whether or not there is a ppp connection, the script gives false positives (but reliable negatives).
I have investigated two other approaches, but I won’t trouble you with the details unless you are interested.