Wait for background processes to complete
- From: pgodfrin <pgodfrin@xxxxxxxxx>
- Date: Sun, 13 Jan 2008 19:08:01 -0800 (PST)
Greetings,
Well - I've spent a bunch of time trying to figure this out - to no
avail.
Here's what I want to do - run several commands in the background and
have the perl program wait for the commands to complete. Fork doesn't
do it, nor does wait nor waitpid.
Any thoughts?
Here's a sample program which starts the processes:
while (<*.txt>)
{
print "Copying $_ \n";
system("cp $_ $_.old &") ;
}
print "End of excercise\n";
exit;
I mean if this were a shell program - this would work:
for x in `ls *.txt`
do
print "Copying $_ \n"
cp $_ $_.old &
done
wait
thanks,
pg
.
- Follow-Ups:
- Re: Wait for background processes to complete
- From: Dougie!
- Re: Wait for background processes to complete
- From: comp.llang.perl.moderated
- Re: Wait for background processes to complete
- From: Ben Morrow
- Re: Wait for background processes to complete
- From: xhoster
- Re: Wait for background processes to complete
- Prev by Date: FAQ 8.36 How do I fork a daemon process?
- Next by Date: Re: Converting milliseconds to seconds
- Previous by thread: FAQ 8.36 How do I fork a daemon process?
- Next by thread: Re: Wait for background processes to complete
- Index(es):
Relevant Pages
|