Hi Monks,

I am looking for some advice/idea on a problem I am facing with the Net::SSH2 Module.

I work in a windows environment with CYGWIN. I succesfully use Net::SFTP::Foreign with Net:SSH2 as a back-end to send and get files my programs need.

I now want my main (father) script to be able to start remote (sons) perl scripts on multiple servers.

I use a batch file to start my perl script. The batch file works fine and starts my perl script the way I want it to when I execute it through RDP. The script runs in a console window.

Here is the code I use to try to start my program :

my $ssh = Net::SSH2->new(); $ssh->connect($IP,$port) or die "Unable to connect $@ \n"; if ($ssh->auth_password($user, $password)) { my $chan = $ssh2->channel(); $chan->exec("c:/foo/bar/myScript.bat \n"); $chan->close; }

The strange thing is it works fine with various apps I tested it with (eg Calc.exe, Notepad.exe, the Padre IDE...) but I can't get it to start and display cmd.exe or batch file execution window. All I see on the server side is a conhost.exe process spawning for a second.

I'm assuming the problem might be not on the perl side as I have it working with some apps. But I thought it wouldn't be dumber to ask for the help of the wise than to stay alone and scared in the darkness of ignorance.

Thank you in advance for anything that could put me in the right direction.

Porax


In reply to Net::SSH2 some programs launch but can't get my script to run by Porax

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.