You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by Troy McBride <tm...@pccc.com> on 2012/11/02 16:18:13 UTC

Script for checking spamd

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", errmode=>"return");

for $server (@server_list) {

$t -> open($server);

$msg = $t -> errmsg;

if($msg ne "") {

print("ERROR: $msg\n");

} else {

$t->cmd(String=>"PING SPAMC/1.0");

$line = $t->getline();

}

$t -> close();

if($line =~ /PONG/) {

push(@goodservers, $server);

}else {

push(@badservers, $server);

}

$line="";

}

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

Thanks,
TDM