Please help a complete newbie

Z

ZoloftGuy

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->input_log('input.txt');
$t->output_log('output.txt');
$t->open("nortelcontivity");
$t->waitfor('/Login:/');
$t->print("admin");
$t->waitfor('/Password:/');
$t->print("thepassword");
$t->waitfor('/CES\>/');
$t->print("en");
$t->waitfor('/Password:/');
$t->print("thepassword");
$t->print("reload restart");
@output1 = $t->cmd('y');
print @output1;
$t->close;

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;
$t->close;

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

pattern match read eof at C:\temp\yo.pl line 18

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

Thanks
 
B

Brian McCauley

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\\
 
Z

ZoloftGuy

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('-');
$t->output_log('-');

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

Last login: Sat Jul 31 23:08:00 from localhost
CES>en
en
Password: thepassword
reload restart
y
thepassword
reload restart
y
Password accepted
command is reload restart (y/n)
bin/en: faking a reset by killing parent pid 11655
[1] 11688
logout
pattern match read eof at yo.pl line 18
linux%
Can anyone tell me what this error means?

Since you did not provide a prompt for $t->cmc('y'), Net::Telnet was
using
the Prompt set in the initial connection, '$'. After sending the 'y',
it
was waiting for a dollar sign, but instead got an eof because the
server
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

-Joe
 

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,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top