Please help a complete newbie

Discussion in 'Perl Misc' started by ZoloftGuy, Jul 29, 2004.

  1. ZoloftGuy

    ZoloftGuy Guest

    The goal is to reboot and or shutdown a Nortel Contivity box with PERL
    and the Telnet Script.

    use Net::Telnet ();

    ###Prompt is "$"

    $t = new Net::Telnet (Timeout => 30, Prompt => '/[\$]/');
    $t->print("reload restart");
    @output1 = $t->cmd('y');
    print @output1;

    When I issue the reload restart commmand, this message pops up from
    the Contivity: (exactly like this, I pulled this from input log.)
    %Proceed with reload? (y/n)

    I then do this:
    @output1 = $t->cmd('y');
    print @output1;

    It works, the box reboots, but I get this error:

    pattern match read eof at C:\temp\ line 18

    Feel free to flame me, I admit, I don't know what the heck I am doing.

    ZoloftGuy, Jul 29, 2004
    1. Advertisements

  2. Please but the subject of you post in the Subject of your post.

    \\ ( )
    . _\\__[oo
    .__/ \\ /\@
    . l___\\
    # ll l\\
    ###LL LL\\
    Brian McCauley, Jul 29, 2004
    1. Advertisements

  3. ZoloftGuy

    ZoloftGuy Guest

    Here is the solution, in case anyone needs it. Thanks to Joe Smith,
    this was resolved in a previous thread.

    I am able to reproduce the error report on Linux using a fake `en`.
    Here's what it looks like when using $t->input_log('-');

    linux% perl
    Red Hat Linux release 9 (Shrike)
    login: admin
    Password: thepassword

    Last login: Sat Jul 31 23:08:00 from localhost
    Password: thepassword
    reload restart
    reload restart
    Password accepted
    command is reload restart (y/n)
    bin/en: faking a reset by killing parent pid 11655
    [1] 11688
    pattern match read eof at line 18
    Since you did not provide a prompt for $t->cmc('y'), Net::Telnet was
    the Prompt set in the initial connection, '$'. After sending the 'y',
    was waiting for a dollar sign, but instead got an eof because the
    closed the telnet connection during its reset.

    If you don't want to see that message, change $t->errmode() just
    before cmd().

    $t->errmode(sub {die @_ unless $_[0] =~ /eof/}); # Be quiet about
    getting eof
    @output1 = $t->cmd('y'); # 'reset' causes telnet eof

    ZoloftGuy, Aug 3, 2004
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.