Solved

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

Posted on 2004-09-17
3
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.
Suggested Courses

622 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