my $concurrent_fork_limit = 9; my $fork_manager = Parallel::ForkManager->new($concurrent_fork_limit); foreach my $server (@servers) { my $pid = $fork_manager->start; if ($pid) { my ($dstamp, $hstamp) = &next_time(); print "$dstamp $hstamp $$: child process started, with a key of $server ($pid)\n"; print "\nWorking On Server -> $server\n"; print "Sending File -> $file\n"; my $timeout = 20; eval { local $SIG{ALRM} = sub { die "alarm\n" }; alarm $timeout; my $rc = system("scp -p $file $user\@$fqdn:$rpath/$fname"); print "\nReturn Code For Server -> $server File -> $file = $rc\n\n\n"; alarm 0; }; if( $@ ) { $nogood{$server}++; } } $fork_manager->finish; } $fork_manager->wait_all_children(); my ($fstamp, $dstamp, $hstamp) = &next_time(); print "\n\n\n$dstamp $hstamp All Children Finished, Continuing\n\n";