LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-25-2004, 07:44 AM   #1
pembo13
Member
 
Registered: May 2003
Location: Caribbean
Distribution: Fedora Core2
Posts: 403

Rep: Reputation: 30
Connectivity Monitoring


Hello,

What would be a suggestion(s) for the most reliable BASH script to check if an internet connection is alive and take action if it isn't. I want to this for incase my ISP plays games with my connection.

Thank you.
 
Old 01-25-2004, 08:32 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You could try connecting to a website with lynx, perhaps your ISPs site and check to see if the return code is "200 OK":
lynx -dump -head http://www.google.com | grep HTTP
 
Old 01-25-2004, 11:52 AM   #3
pembo13
Member
 
Registered: May 2003
Location: Caribbean
Distribution: Fedora Core2
Posts: 403

Original Poster
Rep: Reputation: 30
You're beautiful....I never thought of that....guess i was thinking of too complex a solution. All i need now is to clean up the return string of 'HTTP/1.1 200 OK' to '200 OK'....but I suppose following a BASH HOWTO wil provide me with that...thanks a million.
 
Old 01-25-2004, 02:00 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Try:
lynx -dump -head http://www.google.com|grep HTTP|awk {'print $2" "$3'}
 
Old 01-25-2004, 08:57 PM   #5
pembo13
Member
 
Registered: May 2003
Location: Caribbean
Distribution: Fedora Core2
Posts: 403

Original Poster
Rep: Reputation: 30
Hey thanks alot...
...I really have to make sometime to learn to use GREP and AWK.

Merci
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No connectivity trebek Linux - Networking 5 04-30-2005 10:55 PM
No Network Connectivity bumjubeo Linux - Newbie 3 02-14-2005 08:57 AM
Internet Connectivity is a NO-GO Help Please!! ClericPreston Linux - Newbie 1 06-04-2004 07:36 PM
connectivity or not connectivity munkie_poo Linux - Newbie 0 05-07-2004 06:47 AM
graph connectivity durden2.0 Programming 1 04-17-2004 06:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration