Thanks. I posted here because I knew you (the author) frequented the site.

It could very well be how I've coded it as I'm no expert by any means, but I do tend to know enough to be dangerous. I have an array of ~40 computers that I loop through continuously. The code posted below is run on each of those computers. I have excluded some minor mundane code (such as writing data to a file) for the sake of brevity..

# Create connection my $SSH = Net:OpenSSH->( $IP, user => 'user', password => 'pass' ); if( !$SSH->error ) { # Is my process running? my $PROC = $SSH->capture( "ps aux | grep <process_name> | grep -v + grep | wc -l | sed 's/ *//'" ); if( $PROC == 0 ) { # 3rd party program is run here via perl system method # If it happens to fail, it has no adverse consequences on # the rest of the script. <run 3rd party program> if( <my above 3rd party output condition is met> ) { # Read File on remote machine ( $DATA, $ERR ) = $SSH->capture2( "cat <file on remote +machine" ); # Write/Append $DATA to loca file <write data to loca file> # Delete the remote file $SSH->system( "rm -f <remote file>" ); # And finally, since my remote process is not currently # running, spawn it on the remote machine $SSH-spawn( "./script.pl" ); } } } else { print $SSH-error }

I know all machines can communicate and the main machine that runs this script also has every machine in its known_hosts.

My only assumption is that since this happens for each of the 40 machines, numerous times a day, that OpenSSH (the program, not the module) is hitting some type of barrier due to the sheer # of connections being made causing it to fail

I have added the debug line you suggested and I will post back once it fails (hopefully today, but no later than tomorrow morning)


In reply to Re^2: Net::OpenSSH killing script by jaiieq
in thread Net::OpenSSH killing script by jaiieq

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.