chanakya has asked for the wisdom of the Perl Monks concerning the following question:
Many thanks#!/usr/bin/perl -w use POSIX 'WNOHANG'; use Proc::Queue ':all'; use Getopt::Long 'GetOptions'; my $numChilds=3; GetOptions( 'childs|c=i' => \$opt_numChilds , 'help|h' => \&USAGE ) || USAGE() ; ($opt_numChilds) ? $numChilds=$opt_numChilds : $numChilds; Proc::Queue::size($numChilds); #update my $src="/data/files"; my @allfiles = ("$src/file1", "$src/file2", "$src/file3","$src/file4", +"$src/file5","$src/file6"); my $log = "/tmp/data.log"; open(STAT, $log) || die ("Can't open file $log: $!"); my @pids; foreach my $file (@allfiles) { my ($root=$file); ($root=$file)=~tr/a-z/A-Z/; next if (!-f"$srcdir/ok"); push @pids, Proc::Queue::run_back_now{ #code here system("dataload.pl -file $file > file.err 2>&1"); }; } waitpids(@pids); close STAT; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is this Proc::Queue error
by johngg (Canon) on Dec 06, 2006 at 15:36 UTC | |
|
Re: Is this Proc::Queue error
by salva (Canon) on Dec 06, 2006 at 16:01 UTC | |
|
Re: Is this Proc::Queue error
by derby (Abbot) on Dec 06, 2006 at 15:11 UTC | |
|
Re: Is this Proc::Queue error
by chanakya (Friar) on Dec 06, 2006 at 15:16 UTC |