cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Checking HTTP/Server with curl

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 27 May 2003 15:59:51 +0200 (CEST)

On Tue, 27 May 2003, Roberto Basso wrote:

> Does anybody know how can i check if an http server/application is working
> through the http port number?

Sure, request a page and see if curl returns an error or not. No error =
working fine.

> I have six port numbers to check because i would like to understand why
> sometimes i cannot download page of my site,suspecting it's not working,and
> using other monitoring products i seems all right.   I didn't find any curl
> option to do this..

I would write a shell script:

#!/bin/sh

# untested code

for port in 21 34 45 56 67 80; do

  curl "https://mysite.com:$port/page.html"
  if [ $? -ne "0" ]; then
    echo "curl return $? which means port $port does not really work"
  fi
done

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
Received on 2003-05-27