LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Connectivity Monitoring (https://www.linuxquestions.org/questions/linux-networking-3/connectivity-monitoring-138400/)

pembo13 01-25-2004 07:44 AM

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.

david_ross 01-25-2004 08:32 AM

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

pembo13 01-25-2004 11:52 AM

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.

david_ross 01-25-2004 02:00 PM

Try:
lynx -dump -head http://www.google.com|grep HTTP|awk {'print $2" "$3'}

pembo13 01-25-2004 08:57 PM

Hey thanks alot...
...I really have to make sometime to learn to use GREP and AWK.

Merci


All times are GMT -5. The time now is 07:01 PM.