I'm trying to use Parallel::ForkManager to run an external script to about 200 servers. I am currently running on a Linux server running RH. The external script is kicked off via an ssh command. The server hangs just about everyday and has to be rebooted to recover. Can someone tell me if the external command should be kicked off with 'system', 'exec', or 'backticks'. I don't need to wait on any output from the script. Currently I'm using the backticks.
my $pm = Parallel::ForkManager->new( 10 ); $SIG{ALRM} = sub { die ("TimeOut"); }; eval { alarm( 300 ); foreach my $server (@servers) { my $pid = $pm->start and next; my $fqdn = "$server.$domain"; my $status = `ssh -o UserKnownHostsFile=/dev/null -o StrictH +ostKeyChecking=no $id\@$fqdn cat <$script \"|\" 2>/dev/null $int - -- +fromhost $whoami`; sleep 4; $pm->finish; } $pm->wait_all_children(); alarm(0); }; # end of eval
In reply to Parallel::ForkManager and possible memory leak by jamesgerard1964
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |