Sometimes it is necessary to check whether server you want to run some big bash script is connected to Internet. Usually it makes sense while running scripts periodically using cron.  Below is the tiny bash script for this purpose:



$WGET -q --tries=10 --timeout=5 -O /tmp/ &> /dev/null
if [ ! -s /tmp/ ];then
	echo "no"
	echo "yes"

As you see it tries to download google’s index page, if it’s not empty script returns “yes”, if there is not Internet connection available script will return “no”. If it is impossible to fetch the page in more than 5 seconds script will return “no” as well.

Anything to add? You are welcome! 🙂




  1. June 4, 2013  1:13 am by sacs à main longchamp pas cher Reply

    Hey there, You've done a great job. I'll definitely digg it and personally recommend to my friends. I am sure they wil be benefited from this web site.

  2. June 4, 2013  12:02 pm by salebandoulierechristianlouboutin Reply

    It's very trouble-free to find out any matter on web as compared to books, as I found this piece of writing at this site.

  3. June 5, 2013  12:42 am by saint francois longchamp webcam Reply

    Do you mind if I quote a few of your articles as long as I provide credit and sources back to your blog? My blog is in the very same area of interest as yours and my users would really benefit from some of the information you present here. Please let me know if this alright with you. Thanks!

  4. June 5, 2013  12:43 am by acheter un sac longchamp Reply

    Howdy would you mind letting me know which hosting company you're using? I've loaded your blog in 3 completely different web browsers and I must say this blog loads a lot faster then most. Can you recommend a good hosting provider at a reasonable price? Thanks a lot, I appreciate it!

  5. Pingback : tc 230 | cheapcuut

  6. June 5, 2013  8:44 am by longchamp cabas Reply

    Thankfulness to my father who informed me on the topic of this website, this website is in fact remarkable.

  7. June 5, 2013  8:46 am by st francois longchamp goelia Reply

    Hi to every body, it's my first go to see of this webpage; this webpage includes amazing and really excellent information designed for readers.

  8. June 5, 2013  8:50 am by meteo a saint francois longchamp Reply

    Hello There. I discovered your blog the use of msn. That is a really neatly written article. I will be sure to bookmark it and return to read more of your useful info. Thank you for the post. I will certainly comeback.

  9. June 6, 2013  12:38 am by sac amain longchamp Reply

    obviously like your website however you need to check the spelling on quite a few of your posts. Many of them are rife with spelling issues and I to find it very troublesome to tell the reality however I'll certainly come back again.

  10. June 6, 2013  12:41 am by longchamp nouvelle collection Reply

    Magnificent items from you, man. I have remember your stuff prior to and you are simply too excellent. I really like what you have acquired here, certainly like what you are saying and the way by which you assert it. You are making it entertaining and you still care for to keep it sensible. I cant wait to learn far more from you. This is actually a terrific website.

  11. June 6, 2013  12:41 am by longchamp soldes sac Reply

    Wow, amazing blog layout! How lengthy have you ever been running a blog for? you made running a blog look easy. The overall look of your website is excellent, neatly as} the content material

  12. Pingback : ye 951 | cheapsomd

  13. Pingback : dz 114 | cheapnhyz

  14. Pingback : qo 471 | cheapywda

  15. June 10, 2013  3:40 pm by Nike Free Run Reply

    denne web-siden er noe som er nødvendig på nettet, noen med en liten originalitet. nyttig jobb for å bringe noe nytt til nettet!

  16. Pingback : Michael Kors Purses chpxsr cve089

  17. Pingback : Michael Kors handbags woldsu irg783

  18. Pingback : Michael Kors bags zpvbkc qch862 - Forums

  19. Pingback : Michael Kors Purses jgprtn jox871 - Forums

Leave a reply


Your email address will not be published.