Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Testing for live IP's

by beable (Friar)
on Jul 30, 2004 at 08:34 UTC ( [id://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 = "192.168.0.2"; 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-24 07:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found