I am trying to access multiple clients with my script using Net::Telent. I want to search a bunch of files and look for a specific string. My problem is Net::Telent is returning the error
timed-out waiting for command prompt at findHost.pl line 25 That is the line where I try to login.
When I use telnet manually I can get into the machines, I also am pretty sure I have the regexp for the Prompt variable correct. If anyone can provide a little wisdom into my problem I would be grateful.
here is the code in question...
#!/usr/local/bin/perl -w
use strict;
use Net::Telnet ();
#get the contents of the array from mike.
my (@files, $t, @hosts, $result,$cpu);
$hosts[0]="aster";
$hosts[1]="candytuft";
my $username="user";
my $password="pass";
foreach $cpu (@hosts) {
#use the net telnet module here.
$t = new Net::Telnet (Timeout => '30',
Prompt => '/[%#>] $/',
host=>$cpu);
print " $cpu \n";
$t->login($username, $password);
$t->cmd("cd /usr/openv");
print $t->cmd("usr/bin/ls");
@files = $t->cmd("find . -type f -print | xargs grep \"domain.
+com\" /dev/null");
print "-------------\n";
print "Results for $cpu\n";
print "-------------\n";
my $loc;
foreach $loc (@files) {
print "-- $loc\n";
}
my $tmp = $t->dump_log();
print "This is the dump_log \n$tmp \n";
print "\n\n";
}
Thanks agian
Josh