smutel has asked for the wisdom of the Perl Monks concerning the following question:
I have created a snmp agent in perl.
I use this piece of code to launch sub process :
In check_disk function I have this piece of code :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; } }
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.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 : " . $?);
Thanks for your help.
Regargds,
Samuel Mutel.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange behaviour with SSH command launched with open
by salva (Canon) on Jun 04, 2014 at 11:42 UTC | |
|
Re: Strange behaviour with SSH command launched with open
by RichardK (Parson) on Jun 04, 2014 at 09:59 UTC | |
by smutel (Initiate) on Jun 04, 2014 at 10:54 UTC | |
by RichardK (Parson) on Jun 04, 2014 at 11:36 UTC | |
by smutel (Initiate) on Jun 04, 2014 at 13:02 UTC |