Hiya,

My friend Dave and I have been working on the following script, which has been designed to ping a server and feedback whether or not it is online.

Only trouble is that I can't get it working on my server. I dont know if this is because I have set the path to perl wrong or what, nor do I know how I am supposed to find out what the path is, because my ftp doesn't support the WHEREIS command. :(

If any of you can see a problem in my code below, please let me know at llydapdicter@yahoo.co.uk

Thanx in advance.

#!/usr/bin/perl #file by davidjp@cableinet.co.uk, llydapdicter@yahoo.co.uk use CGI qw(:standard); print header(), start_html("Server Ping Testing"), h1("Ping Results"); @host_array = ("irc.webchat.org","64.177.244.76"); use Net::Ping; $p = Net::Ping->new(); print "$host is alive.\n" if $p->ping($host); $p->close(); $p = Net::Ping->new("icmp"); foreach $host (@host_array) { print "$host is "; print "NOT " unless $p->ping($host, 2); print "reachable.\n"; print "<br>"; sleep(1); } $p->close(); $p = Net::Ping->new("tcp", 2); while ($stop_time > time()) { print "$host not reachable ", scalar(localtime()), "\n" unless $p->ping($host); sleep(300); } print end_html();

2001-03-19 Edit by Corion : Changed title


In reply to Ping via CGI (was: Can't get my script working. Please help! :)) by Llyd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.