
ringo
New User
Sep 26, 2012, 3:00 AM
Post #1 of 2
(812 views)
|
|
simple ping script
|
Can't Post
|
|
Hi I am working on a simple cgi-script to print out ping results. It is a working script but with slight problem #!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use CGI qw(:standard); use strict; # Check our syntax strictly use diagnostics; # Tell us how to fix mistakes use CGI; # Import the CGI module print "Content-type: text/html\n\n"; open PING, 'ping -c 20 www.yahoo.com|' or die 'Failed'; while(<PING>) { print "$_<br>"; } close (PING); --- This script prints the output only after the 20th ping. Is there a way I can print the result while the system is pinging real-time? This is because if the destination is not responding I would wait for sometime before I can find out that it is actually timing out. I would replicated this script as well for traceroute. Thanks in advance.
|