LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Shell script for testing connectivity via URL (https://www.linuxquestions.org/questions/linux-newbie-8/shell-script-for-testing-connectivity-via-url-824394/)

saurabhmehan 08-05-2010 11:01 AM

Shell script for testing connectivity via URL
 
Hi

I have comma separated file containing 3 fields:
Name,Shortcode,URL
Example of file is
Sony,52525,http://17.0.0.1/xyz
NDTV,53636,http://10.0.0.1/abc

Now i want to test every URL connectivity from my server by executing it using shell script and if url gives back response it shows output as "OK" in green color and if url is not responding it shows "NOT CONNECTED" in red color.

Output will be like following
Sony 52525 OK
NDTV 53636 NOT CONNECTED

Please help

Thanks in advance

jstephens84 08-05-2010 11:14 AM

Quote:

Originally Posted by saurabhmehan (Post 4056953)
Hi

I have comma separated file containing 3 fields:
Name,Shortcode,URL
Example of file is
Sony,52525,http://17.0.0.1/xyz
NDTV,53636,http://10.0.0.1/abc

Now i want to test every URL connectivity from my server by executing it using shell script and if url gives back response it shows output as "OK" in green color and if url is not responding it shows "NOT CONNECTED" in red color.

Output will be like following
Sony 52525 OK
NDTV 53636 NOT CONNECTED

Please help

Thanks in advance

What you could use is php-cli and check the return like a 200 - would say page is loaded and returned. You would also use bash with curl.

TB0ne 08-05-2010 11:27 AM

Essentially a duplicate post asking the same thing, except with just a BIT more information. Again, we will HELP you, but we're not going to write this FOR YOU....post what you've written.


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