keep getting time out on Net::Telnet->cmd in my perl script

V

Vic

I've a perl script which tries to telnet into a server and then
execute a few command
Here is my code

sub AgaBringDown {
my ($GVHOME,$Server) = @_;
my $string;
my @lines;

### Seting up the GVHOME
#$ENV{'GVHOME'} = $GVHOME;
my $username = 'vpatanka';
my $passwd = 'gen2boyS2';
my $t = new Net::Telnet (Timeout => 10, Prompt => '/login: $/i');
$t->open("$Server");
$t->waitfor('/login: $/i');
$t->print($username);
$t->waitfor('/password: $/i');
$t->print($passwd);

$string = "setenv GVHOME $GVHOME";
my $temp = $t->cmd($string);
}

As I mentioned I keep getting error on the last line
command timed-out at ConfigurationSetup.pl line 270
at /usr/local/geneva/perl/lib/site_perl/5.8.8/Net/Telnet.pm line 2036
Net::Telnet::_croak('Net::Telnet=GLOB(0x879538)', 'command
timed-out') called at /usr/local/geneva/perl/lib/site_perl/5.8.8/Net/
Telnet.pm line 539
Net::Telnet::error('Net::Telnet=GLOB(0x879538)', 'command
timed-out') called at /usr/local/geneva/perl/lib/site_perl/5.8.8/Net/
Telnet.pm line 361
Net::Telnet::cmd('Net::Telnet=GLOB(0x879538)', 'setenv GVHOME /
home/vpatanka/800currentSAGAV2_P') called at ConfigurationSetup.pl
line 270
main::AgaBringDown('/home/vpatanka/800currentSAGAV2_P',
'nemo') called at ConfigurationSetup.pl line 190
main::SetupConfig() called at ConfigurationSetup.pl line 123
main::SetupData() called at ConfigurationSetup.pl line 29

If I login manually in telnet with the same steps it works fine.
Please help. thanks
 
V

Vic

I've a perl script which tries to telnet into a server and then
execute a few command
Here is my code

sub AgaBringDown {
    my ($GVHOME,$Server) = @_;
    my $string;
    my @lines;

    ### Seting  up the GVHOME
    #$ENV{'GVHOME'}  = $GVHOME;
    my $username = 'vpatanka';
    my $passwd = 'gen2boyS2';
    my $t = new Net::Telnet (Timeout => 10, Prompt => '/login: $/i');
    $t->open("$Server");
    $t->waitfor('/login: $/i');
    $t->print($username);
    $t->waitfor('/password: $/i');
    $t->print($passwd);

     $string = "setenv GVHOME $GVHOME";
      my $temp = $t->cmd($string);

}

As I mentioned I keep getting error on the last line
command timed-out at ConfigurationSetup.pl line 270
 at /usr/local/geneva/perl/lib/site_perl/5.8.8/Net/Telnet.pm line 2036
        Net::Telnet::_croak('Net::Telnet=GLOB(0x879538)', 'command
timed-out') called at /usr/local/geneva/perl/lib/site_perl/5.8.8/Net/
Telnet.pm line 539
        Net::Telnet::error('Net::Telnet=GLOB(0x879538)', 'command
timed-out') called at /usr/local/geneva/perl/lib/site_perl/5.8.8/Net/
Telnet.pm line 361
        Net::Telnet::cmd('Net::Telnet=GLOB(0x879538)', 'setenv GVHOME /
home/vpatanka/800currentSAGAV2_P') called at ConfigurationSetup.pl
line 270
        main::AgaBringDown('/home/vpatanka/800currentSAGAV2_P',
'nemo') called at ConfigurationSetup.pl line 190
        main::SetupConfig() called at ConfigurationSetup.pl line 123
        main::SetupData() called at ConfigurationSetup.pl line 29

If I login manually in telnet with the same steps it works fine.
Please help. thanks

There was an issue with the prompt at the remote host. I got it fixed.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top