Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Net::SSH2 Interactive command example

by Anonymous Monk
on Apr 26, 2013 at 11:52 UTC ( #1030809=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Net::SSH2 Interactive command example
in thread Net::SSH2 Interactive command example

Hello everyone I have been trying to use this kind of scripts to connect to a remote machine and execute some commands. I think the connection is well done, but the execution of commands is not working for me. This particular case is about: 1.- I connect via ssh to a linux machine 2.- I enter in a special mode with MML commands (machine to man language) typing 'mml' 3.- I do staff with this mml commands My script is failing in step 2. I just want to send this "mml" and it's not working :( :(

if( $ssh2->connect($host) ) { if( $ssh2->auth_password($user,$pass) ) { print "connected.....\n"; #shell use my $chan = $ssh2->channel(); $chan->blocking(0); $chan->shell(); print "sending command....\n"; my $num = 10; while($num--){ sleep(1); } print $chan "mml\n"; select(undef,undef,undef,0.2); print $buf while ($len = $chan>read($buf,512)) > 0;
I tried with several methods: print $chan, exec ('comand'), everything in this thread... but still not working. Any idea?


Comment on Re^3: Net::SSH2 Interactive command example
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030809]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-12-27 03:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls