Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^3: Testing for live IP's

by beable (Friar)
on Jul 30, 2004 at 08:34 UTC ( #378628=note: print w/replies, xml ) Need Help??

in reply to Re^2: Testing for live IP's
in thread Testing for live IP's

Actually, traceroute doesn't "return a lot", it returns 0 for success, and 1 for failure, like many programs. It does "output a lot", but that's easy to fix. See if this works for you:

#!/usr/bin/perl use strict; use warnings; # IP adress or hostname of the remote machine to test my $remote = ""; if(system("traceroute $remote 1> /dev/null 2>&1")) { print "$remote is down\n"; } else { print "$remote is up\n"; } __END__

Replies are listed 'Best First'.
Re^4: Testing for live IP's
by Elijah_A (Novice) on Jul 30, 2004 at 09:00 UTC
    Does the 0 for success of traceroute means that it successfully executed the command? or does it mean that it found valid IP's? Sorry I'm new to traceroute.

    Thanks for fixing up the script, it takes too long to test though.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://378628]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2023-03-26 03:42 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (63 votes). Check out past polls.