I am trying to write a script that takes an array of server names and pings their spamd to make sure that it is still alive.

$t = new Net::Telnet(Prompt=>'//', Port=> 783, output_log=>"out_log.txt", input_log=>"in_log.txt");

for($i=0;$i<$count;$i++) {
  $t -> open(@server_list[$i]);
  $line = $t->cmd(String=>"PING SPAMC/1.0");
  $line = $t->getline();

  if($line =~ /PONG/) {
    push(@goodservers, $server_list[$i]);
  }  else {
    push(@badservers, $server_list[$1]);
  }

}

Is this a stable solution to my problem? Has anyone done anything like this and been successful?

Thanks,
TDM

Reply via email to