in reply to Is My Server Up??

Since you cannot install Net::Ping, how about:
if (`ping -c 1 my.test.com` =~ /1 recieved/) { print "Alive!\n"; } else { print "Dead\n"; }
-- Joost downtime n. The period during which a system is error-free and immune from user input.

Replies are listed 'Best First'.
Re: Re: Is My Server Up??
by Anonymous Monk on Sep 09, 2002 at 15:44 UTC
    Hi There

    I just tried the code and when i replace my.test.com with localhost and run the script it tells me that the system is dead....
Re: Re: Is My Server Up??
by Anonymous Monk on Sep 09, 2002 at 15:48 UTC
    Sorry, i just realised the 'recieved' typo. Just one more question, is there any way to do a tcp connect rather than a ping?
      Assuming your server is running a web-server:
      use IO::Socket::INET; $sock = IO::Socket::INET->new( PeerAddr => 'www.mysite.com', PeerPort => 80, Proto => 'tcp'); if ($sock) { print "yep"; } else { print "nope"; }


      --twerq
      Nope. Just changed the spelling and it is still reporting that the server is down, even tho when i run the command it comes back with 1 packets received