mohamedaiman has asked for the wisdom of the Perl Monks concerning the following question:
When I run this output, nothing is logged which is what I expect to be done when I run commands from the command terminal (HOSTA:5051). I would appreciate if someone can give me a pointer on how to overcome this problem. Thank you. Thanks p.s, i know the code looks messy. will clean up once i figure out this glitch.use Net::Telnet; use POSIX qw(strftime); my $lognamevar = strftime "%y-%m-%d", localtime; my $dumpscreen_in = "dmpscrn-in-".$lognamevar.".txt"; my $dumpscreen_out= "dmpscrn-out-".$lognamevar.".txt"; my $dumpscreen_dump= "dmpscrn-dmp-".$lognamevar.".txt"; my $user = "root"; my $pass = "root"; open(DMPSCRNIN, ">>$dumpscreen_in") || die "Cannot open Dumpscreen tel +net on port 5005 for error-trapping:$!\n"; open(DMPSCRNOUT, ">>$dumpscreen_out") || die "Cannot open Dumpscreen t +elnet on port 5005 for error-trapping:$!\n"; $DMPSCRN_IN = *DMPSCRN_IN; $DMPSCRN_OUT = *DMPSCRN_OUT; $DMPSCRN_DMP = *DMPSCRN_DMP; tlnDumpScreen; sub tlnDumpScreen{ $dmpscreen = new Net::Telnet( Timeout=>10, Prompt=>'/.+>/', Input_log => $DMPSCRN_IN, Output_log => $DMPSCRN_OUT, Dump_Log => $DMPSCRN_DMP, Host => '192.168.6.40', Port => '5005' ); $dmpscreen->open(); $dmpscreen->waitfor('/name:/'); $dmpscreen->print($user); $dmpscreen->waitfor('/password/i'); $dmpscreen->print($pass); $dmpscreen->waitfor('/name:/'); $dmpscreen->print('getlinglines'); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capturing output from a dummy telnet session.
by bulent_sahin (Initiate) on Oct 30, 2007 at 16:40 UTC |