Most of the users all over the world make use of Google’s Index Page to check whether their Internet connection is working or not. Many times it is required to check periodically whether the server you are running is connected to internet or not. It is very cumbersome to open the web page every time you wish to check the connection. As an alternative, it definitely makes sense to run some scripts in the background periodically scheduling them using cron.
The bash script that can be used for this purpose is given below:
Full areticle here:
Basic Linux Shell Scripting Language : A Simple BASH Script to Test Your Internet Connectivity (Your Own Linux..!)
More interesting Linux tutorials and articles at this site