Perlfunc: is_pingable()

Simple function to shell out to ping and see if a host is pingable

sub is_pingable() {
   my $ip = shift();

   my $cmd = "/bin/ping $ip -c 1 -W 1";

   my $exit = $?;

   # Unix returns 0 as good, and not-zero as bad so we invert it
   return int(!$exit);
Leave A Reply
All content licensed under the Creative Commons License