Solved

How to check if a domain is live even if PING is blocked?

Posted on 2004-09-17
3
341 Views
Last Modified: 2011-04-14
I have been using PING to check if a domain is live, however, some domains, depsite being available on port 80, are blocking PING.

       $response=shell_exec("ping $site -n -c 1 -w 2 -W 2");

I want a fast way of testing port 80, if it is live or not.  This must be an automated solution as it needs to be part of a script.
0
Comment
Question by:vincevincevince
3 Comments
 

Expert Comment

by:philipp999
ID: 12089033
Hi,

would this work? (needs netcat installed):
printf "GET / HTTP/1.0\n\n" | nc -w $timout $host $port | perl -pe 'if(m|^HTTP/1\.1 200 OK|) { print "OK\n"; } else { print "NOPE\n";} exit(1);'

best,

philipp
0
 
LVL 6

Accepted Solution

by:
blkline earned 100 total points
ID: 12090018
Perhaps something like:

wget -q -O /dev/null URL && echo "success"

or

wget -q -O /dev/null URL || echo "failure"

might fit the bill?  

URL can be ftp://  or http:// styles.

wget has quite a number of options from which to choose for timeouts and retries and such.

Barry
0
 
LVL 1

Author Comment

by:vincevincevince
ID: 12091172
Barry, that is just perfect, thanks :-)

You really deserve the points, I wish I had more to give
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question