Hi

I wrote the following script to fork ssh processes with perl and
Parallel::ForkManager:

#!/usr/local/bin/perl -w
use strict;

my @cmd = "@ARGV";
use Parallel::ForkManager;
my @nodes;
open(NODE,"<list") || die "!$\n";
while(<NODE>) {
        chomp;
        push(@nodes,$_);
}


my   $pm = new Parallel::ForkManager(10);       # Max 10 procs
for my $node(@nodes) {
        my $pid = $pm->start and next;
        my $res = `ssh $node "@cmd"`;
        print "$res";
        $pm->finish;
        
}



This works pretty well, but Since There is More than One Way to DO it,
i wonder if anyone has another version that does not use fork?

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to