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";
   `$cmd`;

   my $exit = $?;

   # Unix returns 0 as good, and not-zero as bad so we invert it
   return int(!$exit);
}


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.236.219.157
To prevent spam please submit by clicking the kitten: