Please help a complete newbie

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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.


Re: Please help a complete newbie (ZoloftGuy) writes:

> Subject: Please help a complete newbie

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

     \   ( )
  .  _\__[oo
 .__/  \ /\@
 .  l___\
  # ll  l\
 ###LL  LL\

Re: Please help a complete newbie

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

> Can anyone tell me what this error means?

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


Site Timeline