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; } } #### my $cmd = 'ssh -qt ' . $disk->{controller_ipaddr} . ' "sudo '. $CMD_STORCLI . ' /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 = ) { $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 : " . $?);