Hello,

I have created a snmp agent in perl.

I use this piece of code to launch sub process :

foreach my $disk (@tab_disks) { my $pid = fork(); if ($pid) { push(@childs, $pid); } elsif ($pid == 0) { $logger->info("Creating new sub-process"); check_disk($logger, $disk); $logger->info("Exit sub-process"); exit; } }
In check_disk function I have this piece of code :
my $cmd = 'ssh -qt ' . $disk->{controller_ipaddr} . ' "sudo '. $CMD_ST +ORCLI . ' /c0/e' . $disk->{physical_id} . '/s' . $disk->{slot_id} . ' + show 2>&1"'; $logger->debug("Execute command : " . $cmd); open COMD, "$cmd|" or die "Cannot execute $cmd: $!"; while (my $line = <COMD>) { $logger->debug("Line : " . $line); chomp($line); if ($line !~ /$disk->{physical_id}/) { next; } $line =~ s/^\s+|\s+$//g; if (exists($DISK_STATUS{$line})) { $new_status_txt = $line; $new_status = $DISK_STATUS{$line}; $logger->debug("New status is : " . $new_status); } else { $new_status_txt = $line; $new_status = $DISK_STATUS{Other}; $logger->debug("New status is : " . $new_status); } } close COMD; $logger->debug("Command exit status : " . $?);
I have about 20 entries in tab @tab_disks. On this 20 entries, 2-3 random ssh command launch with open returns exit code 65280. It is not all the same.

Thanks for your help.

Regargds,

Samuel Mutel.


In reply to Strange behaviour with SSH command launched with open by smutel

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.