Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Start processes stored in array and wait in between

Reply
Thread Tools

Start processes stored in array and wait in between

 
 
Mario.Becker@gmx.com
Guest
Posts: n/a
 
      05-10-2005
Hi folks,

it's probably a simple question...

I want to start several processes with perl whose names are stored in
an array. Before calling/executing the next file I want to wait a
certain time.

How do I have to modify the example below?

# Run multiple background processes.
my @processes = ("process01.exe 1",
"process02.exe 2",
"process03.exe 3");

unless (fork)
{
# running as child process
exec $_ or die "Exec of $_ failed!"; # shouldn't happen
} # only parent runs here
}

Has anyone a suitable solution? That'd be kind?


Thanks a lot in advance.
Mario

 
Reply With Quote
 
 
 
 
A. Sinan Unur
Guest
Posts: n/a
 
      05-10-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote in news:1115713069.225791.240130
@f14g2000cwb.googlegroups.com:

> I want to start several processes with perl whose names are stored in
> an array. Before calling/executing the next file I want to wait a
> certain time.


perldoc -f sleep

Sinan
--
A. Sinan Unur <(E-Mail Removed)>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html
 
Reply With Quote
 
 
 
 
Salvador Fandino
Guest
Posts: n/a
 
      05-10-2005
(E-Mail Removed) wrote:
> Hi folks,
>
> it's probably a simple question...
>
> I want to start several processes with perl whose names are stored in
> an array. Before calling/executing the next file I want to wait a
> certain time.
>
> How do I have to modify the example below?
>
> # Run multiple background processes.
> my @processes = ("process01.exe 1",
> "process02.exe 2",
> "process03.exe 3");
>
> unless (fork)
> {
> # running as child process
> exec $_ or die "Exec of $_ failed!"; # shouldn't happen
> } # only parent runs here
> }
>
> Has anyone a suitable solution? That'd be kind?


you can use Proc::Queue for that:

use Proc::Queue qw(system_back);
Proc::Queue::delay(10); # sets min delay between fork calls
Proc::Queue::size(5); # sets max number of children

system_back $_ for @processes;

Cheers,

- Salvador
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      05-10-2005
(E-Mail Removed) <(E-Mail Removed)> wrote:

> I want to wait a
> certain time.



perldoc -f sleep


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling processes and what to "feed" other processes Marc Heiler Ruby 1 05-24-2009 05:37 PM
How to wait for *all* children processes to return? loudking C Programming 1 05-17-2007 07:22 PM
Main-process doesn't wait for child-processes Markus Franz Python 1 04-22-2004 05:51 PM
How do I: Main thread spawn child threads, which child processes...control those child processes? Jeff Rodriguez C Programming 23 12-09-2003 11:06 PM
Please Wait for Javascript Processes Mark Foong Javascript 1 06-30-2003 08:15 PM



Advertisments