To check if you have internet connectivity, one method is to issue periodically an http GET command to a server on the internet (find one that does not redirect to https://) and see if you get a result back. Google for Arduino web client. In the case of failure, issue a command to restart your Arduino. Google for reset Arduino with code.