I am writing a script which requires me to test servers for listening SSH ports and push the working hostnames into an array. I decided on using NET:SSH
erl for this task, because our firewall blocks both Telnet and Ping requests, so I am stuck using an actual SSH connection to see if the port is listening. Has anyone successfully accomplished this? Bascally, I figure I am going to have to attempt a new connection, but can I just do something like:
foreach $host (@hosts){
$cnx = NET::SSH
erl->new($host);
if($cnx){
push (@working, $host);
}
$cnx->close;
}
I guess my main question would be, would that if statement actually validate a working connection or not??
Please help. Any and all is appreciated.
-Eric
foreach $host (@hosts){
$cnx = NET::SSH
if($cnx){
push (@working, $host);
}
$cnx->close;
}
I guess my main question would be, would that if statement actually validate a working connection or not??
Please help. Any and all is appreciated.
-Eric