From: J. Gleixner on
EZP wrote:
> Hi all,
> I'm running the script below in windows command line and the script is
> stuck.
> (I need to run the unix task from the windows command line.)
> #!/usr/bin/perl
> use strict; use warnings;
> use Net::SSH qw (ssh issh sshopen2 sshopen3);

There's no need to import issh, sshopen2, or sshopen3, unless you're
going to use them and you do that so you can simply make a call to
"ssh_cmd" instead of Net::SSH::ssh_cmd. Not that it'll hurt anything,
but it's redundant to do both.

> print Net::SSH::ssh_cmd( {
> host => '',
> command => 'ls',

Using a full path name to the command is a safer approach.

> } );
> please help, thanks in advance.

Make sure you SSH at least once to the host.

Usually, when SSH'ing to a host for the first time, you get
a "Are you sure you want to continue connecting (yes/no)?" prompt,
possibly that's what it's waiting for.

If you can SSH from the command line, wrap your call in an eval, and
print any errors.

eval {
my $data = Net:SSH::ssh_cmd( ... );
print "data=$data\n";
print "ssh_cmd failed: $@\n" if @$;