![]() ![]() Yet again, there are shortcomings in this approach. Checking the return code is straightforward way to do implement this: wget -spider -quiet Įcho "Website failed!" | mail -s "Website down" You'll get some false positives when your computer is down, or when your DNS server is not working. Second, using wget -spider for your own script is a good idea. (Disclaimer: I am not affiliated with Pingdom in any way). To pick one, Pingdom includes free account for monitoring one target. What do you think?įirst, multiple good online monitoring services are available. Also (I was trying to avoid any I/O) I can write to a log file by which I can check the count of downtime checks and then skip further checks till the site is down or cause longer checks (10mins instead of every min). Right? Also how can I randomize pinging to a different site everytime, like facebook, google, yahoo etc. Its a bit heavy (as I am not using ping) but should not give any false positives. This way I need to check for internet connectivity only where there is an issue with my blog response code. # Check if we have internet connectivity by some other siteįLAG=1 # This means we do have internet connectivity and the blog is actually downĭISPLAY=:0 notify-send -t 2000 -i /home/ashfame/Dropbox/Ubuntu/icons/network-idle.png "Downtime Alert!" " is down." # A good point is to check if the internet is working or not # Traverse the string considering it as an array of words ![]() # Sending the output of the wget in a variable and not what wget fetches Here is my script to keep checking downtime for my blog: #!/bin/bash So, checking for DNS and LAN connectivity is a bit overkill for me as I don't have that much specific need to figure out what problem it is. Now I want to make sure that it displays me notification when I do have internet connectivity. So I keep on getting notifications as the script couldn't find 200 in the wget response. LAN was connected fine but just I couldn't access any site. Now yesterday, there was some problem with my Internet. If its not 200, it notifies me (I believe this will be better than just pinging it, as the site may under be heavy load and may be timing out or respond very late). I have setup cron to check it every minute.įor this, I am checking the HTTP response code of wget -spider to my blog. My intention at the moment is to check if my blog is down. But I think there must be easy way without the need of checking a site that never crash )Įdit: Seems like there can be a lot of factors which can be individually examined, good thing. One idea I seem is to wget -spider and check the HTTP response code to interpret if the Internet connection is working fine. Is there an easy way to check Internet connectivity from console? I am trying to play around in a shell script. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |