Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Creating a simple Ping Script - need help

Posted on 2004-11-16
Medium Priority
Last Modified: 2010-04-06
I am looking to find/learn to create a simple script that can ping servers to see if they are down or not. I have searched online in tons of places and come up with a php script, but I don't have enough permissions to use the exec() commands. Could anyone help me create / point me in the direct of a script in any language that would enable to me ping specific servers that does not require administrative permission? Thanks.

Below is what I have thus far:

echo "Server Status by IP:<br>";

$sites = array();
$sites[] = '';  
$sites[] = '';

foreach($sites as $ip) {
// system() / shell_exec() / exec() - none work
$cmd = shell_exec("ping -c 1 -w 1 $ip");
$ping_results = explode(",",$cmd);
if (eregi ("0 received", $ping_results[1], $out)) { echo "Server is down"; }
if (eregi ("1 received", $ping_results[1], $out)) { echo "Server is up"; }

Question by:nathanmx

Accepted Solution

georgecooldude earned 500 total points
ID: 12594207
How about this script?

Expert Comment

ID: 12609652
This ASP script requires installing a component on the server.  Not sure if that's possible for you since you asked for a non-administrative permission script, but here it is anyway:
http://www.serverobjects.com/products.htm (scroll all the way to the bottom for ASPPing)

What is the web server that you are using?  That'll help us give you a more appropriate scripting language.


Author Comment

ID: 12611801
I looked at that one previously and dismissed it, but since no other one worked, I had to try it. I ended up using only about 10% and doing 90% of my own coding, but the result worked. So I believe thanks is in order. ;)

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

564 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