Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
You're right. command_remove_mode does have an impact. For instance on CentOS at the time of initialization Net::Telnet object, if I'm setting cmd_remove_mode as 0, then I'm able to get command output without command. Here are the logs for the same
my $ssh = new Net::Telnet ( -fhopen => $pty, -prompt => $args{prompt}, -telnetmode => 0, -cmd_remove_mode => 1, -timeout => SSH_TIMEOUT, -output_record_separator => "\r", #-errmode => sub { print "Telnet FAIL\n"; } ); Output of script execution [root@hyd1658 attribute_template]# perl test_centos.pl output is Thu Jul 4 11:18:18 IST 2019 [root@hyd1658 ~]
However, if I set cmd_remove_mode as 1 then the output is getting choped. Here are the logs-
my $ssh = new Net::Telnet ( -fhopen => $pty, -prompt => $args{prompt}, -telnetmode => 0, -cmd_remove_mode => 1, -timeout => SSH_TIMEOUT, -output_record_separator => "\r", #-errmode => sub { print "Telnet FAIL\n"; } ); Output of script execution [root@hyd1658 attribute_template]# perl test_centos.pl output is [root@hyd1658 ~]
This(chopping of 1 line of output) does make sense from the following piece of code of Net::Telnet
sub cmd { . . . ## Determine if we should remove the first line of output based ## on the assumption that it's an echoed back command. if ($cmd_remove_mode eq "auto") { ## See if remote side told us they'd echo. $telopt_echo = $self->option_state(&TELOPT_ECHO); $remove_echo = $telopt_echo->{remote_enabled}; } else { # user explicitly told us how many lines to remove. $remove_echo = $cmd_remove_mode; } ## Get rid of possible echo back command. while ($remove_echo--) { shift @$output; } . . .
But in either case, the command sent should have been echoed in the output, which in this case is not happening. Do you have any suggestion on what could be its root cause or what piece of code is responsible for this.

In reply to Re^2: Command sent via Net::Telnet is not getting logged in CentOS. However, the same is getting logged in Fedora 20 by shoundic
in thread Command sent via Net::Telnet is not getting logged in CentOS. However, the same is getting logged in Fedora 20 by shoundic

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-03-28 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found