Hi,
There are many ways to check if you have a connection to your operator/mobile data.
The first one would be ping reboot functionality, that will let you ping outside network and if it's not reached in X retries, it will execute one of these actions:
Reboot | Modem restart | Restart mobile connection | (Re)register |
The second one is just checking if gsmctl commands giving you the information about your operator and current connection circumstances.
If you execute gsmctl -F and you get this output: +QNWINFO: "FDD LTE","24601","LTE BAND 3",1348
it means that you've successfully connected. If after executing this command you get a Timeout or something that doesn't have anything to do with correct output - it means you're not connected or something else is broken.
The third one is just parsing through system log, that you can see when you execute logread, logread -F (for continuous logread steam) or just downloading troubleshoot file and finding the system log there.
The thing is, that the system log is outputting everything, so it will show that it connects and disconnects 10 times before it really connects to the operator as it supposed to. So please do your research and select strings carefully, if you're going to put it in your script as an identifier.
EB.