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:

#!/bin/bash

WGET="/usr/bin/wget"

$WGET -q --tries=10 --timeout=5 http://www.google.com -O /tmp/index.google &> /dev/null
if [ ! -s /tmp/index.google ];then
	echo "no"
else
	echo "yes"
fi

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! :)

 

144 Comments

 

  1. Pingback : christian louboutin sacs louis vuitton #include ca | PyaarDosti.com | A Blog about everything in Love, Friendship and inbetween.

  2. August 16, 2012  8:11 am by overbrake Reply

    thanks a lot! very useful script :D

  3. Pingback : HTM01-05 Questions & Answers » Answers Archive » sacs louis vuitton Stitcher Radio News & Talk

  4. Pingback : Anonymous

  5. Pingback : Central California – L.A. NOW – latimes.com | H?i ?áp 360

  6. Pingback : Hambourg - Electronica Music Discussion Forum

  7. December 18, 2012  1:36 am by web design Reply

    Thank you, I've recently been searching for info about this topic for ages and yours is the greatest I have discovered so far. But, what about the conclusion? Are you sure about the source?

  8. March 31, 2013  10:18 pm by Charlotte olympia bottes pas cher Reply

    Hi my loved one! I wish to say that this article is awesome, nice
    written and come with approximately all significant
    infos. I would like to look more posts like this .

  9. April 10, 2013  4:12 am by c211o2k1jg Reply

    Online Rajasthani apparelColors that are usually seen on Rajasthani costumes carry ample meaning to speak of the individual`s status. Thus, color symbolism within the costumes of Rajasthan has been carrying forward its marvelous tradition of vivacity.Lehanga duppatta or ghagra choli of Rajasthan ,kids toms, traditional wear is a reasonably famous female ethnic wear. The Ghagras are generally short extending as much as the calf while the Lehengas are longer and are as long as the ankles. The more formal occasions and prosperous households dictate increased width and much more quantity of folds or pleats in the skirts. These Ghagras and Lehengas will also be embroidered and decorated much in the same style as sarees are.Choli or kanchli is really a short blouse which ends up just beneath the blouse; while kurti are long blouse which will come down the waist. Dupatta or Odhna is an essential part of ghagra choli, it's 5 feetwide 10 feet long cloth, draped across gracefully to pay for the top by women in short veil. They are able to have tie-and-die work, gota borders, mirror work and could be a number of festive colors like orange, red, yellow and pink.The block prints, tie and dye prints, Bagaru prints,toms outlet, Sanganer prints, Zari embroidery are major export products from Rajasthan. It's also seen as a a pattern that is square-checkered. This really is one fabric that is usually utilized in Rajasthani saris. Bandhej salwar suit are more popular among the indiam female becoz its bright colour.Traditional men attire includes pagari or safa, angarakha or achkan and dhoti or pyjama. Turban or pagri is really a headgear, which comes in different shapes sizes color. A common pagri is usually 82feet long and 8inches wide. Its Wedding turban may be the accessory groom that enhances his charm and symbolizes a feeling of pride and dignity. Male of bride and groom's family also wear turban during wedding.Angrarakha is really a long-sleeved tunic having a wrap V-neck front that ties in the side. It may be long or short in length.Dhoti is sort of a loose pajama that covers the low body. 4 meters long and 1 meter in width, wearing a dhoti right is really a skill that requires reasonable practice. Most commonly, the dhotis are made of very light cotton and therefore are usually white in color. On special events,toms for men, silk dhotis with zari borders make the outfit festive.Jodhpuri breeches, is a baggy - tight, jodhpurs polo trousers and coat is perfect attire for wedding and other special occasions.

  10. Pingback : lé facilement l’épreuve jusqu’au bout n’a pu se montrer mena | ???966???

  11. Pingback : ArtLiO - Article Liberty Online | Karen Millen Dresses YGQFVNV8136349 UVGJECF4667503

  12. Pingback : Karen Millen Dresses JYQIWOA9375191 XTUEFXP9205362 « mein-mut-coach

  13. Pingback : a estcompleacute | A Place of Refuge

  14. Pingback : freed blacks | ???290???

  15. Pingback : 2013 The Best Sunglasses For You EFFMFA5729 ZWCB398042 | Angel6bFw's Blog

  16. Pingback : gucci uk sale FFCU-3080 ejT42 mulberry sale | tzwipdjlad

  17. Pingback : oakley jupiter 5623 « Blog MS Aktiv-Haus e.V

  18. Pingback : ?????? lQsn mX | eMtjm7dSG

  19. Pingback : Karen Millen Dresses ZMSDUJB3149504 DVKXGJW7126902 | Anniehz21's Blog

  20. Pingback : ???? p43 9nZ Hb | egtae2bBF

  21. Pingback : ?????? aJP4 8Jv8

  22. Pingback : ???? RVAq 8zs2 | egtae9dKZ

  23. Pingback : ??·???? QL3 hOH pq | sFPl97ch

  24. Pingback : A quality combination modern along with standard clothes will attempt to wo | Wazzeh !!

  25. Pingback : Consider it as you want overall flexibility connected with assumed or maybe | Wazzeh !!

Leave a reply

 

Your email address will not be published.