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

Discussion in 'Perl Misc' started by Vic, Sep 9, 2009.

  1. Vic

    Vic Guest

    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
    Vic, Sep 9, 2009
    #1
    1. Advertising

  2. Vic

    Vic Guest

    On Sep 9, 1:18 pm, Vic <> wrote:
    > 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
    Vic, Sep 10, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Achim Domma (Procoders)

    read input for cmd.Cmd from file

    Achim Domma (Procoders), Jun 3, 2005, in forum: Python
    Replies:
    2
    Views:
    8,034
    Peter Otten
    Jun 3, 2005
  2. Carcarius
    Replies:
    0
    Views:
    275
    Carcarius
    Dec 6, 2007
  3. born in USSR

    Net:Telnet cmd() stop performance

    born in USSR, Sep 15, 2009, in forum: Ruby
    Replies:
    1
    Views:
    156
    born in USSR
    Sep 16, 2009
  4. justme

    returning from Net::Telnet cmd

    justme, Oct 29, 2004, in forum: Perl Misc
    Replies:
    0
    Views:
    98
    justme
    Oct 29, 2004
  5. Replies:
    15
    Views:
    1,039
Loading...

Share This Page