Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Net::SSH2 Command Timeout Before Completion

by salva (Canon)
on Jun 29, 2010 at 18:42 UTC ( [id://847180]=note: print w/replies, xml ) Need Help??


in reply to Net::SSH2 Command Timeout Before Completion

If you have a recent version of OpenSSH installed on the machine where you want to run the script, try Net::OpenSSH:
use Net::OpenSSH; my $ssh = Net::OpenSSH->new('root@192.168.123.5'); $ssh->error and die "unable to connect to remote host: ". $ssh->error; my $fh = $ssh->pipe_out("/sbin/service", "syslog", "restart") or die "command failed: " . $ssh->error; print while <$fh>; close $fh or die "command failed: $?";

Replies are listed 'Best First'.
Re^2: Net::SSH2 Command Timeout Before Completion
by taim (Initiate) on Jun 29, 2010 at 23:57 UTC

    Another one I will look at. OpenSSH is my client/server of choice.

      Another one I will look at. OpenSSH is my client/server of choice.

      For what it's worth, Net::SSH::Expect lets you choose what ssh binary to use, so if you have openssh installed separately, it can be told to use that. Not trying to be a fanboy, just letting you know.
        I appreciate the information. What I gathered from testing both is that Net::SSH2 is not the best solution. Both of your examples worked the way I wanted.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (8)
As of 2024-04-19 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found