Start processes stored in array and wait in between

Discussion in 'Perl Misc' started by Mario.Becker@gmx.com, May 10, 2005.

  1. Guest

    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
     
    , May 10, 2005
    #1
    1. Advertising

  2. 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 <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, May 10, 2005
    #2
    1. Advertising

  3. 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
     
    Salvador Fandino, May 10, 2005
    #3
  4. <> wrote:

    > I want to wait a
    > certain time.



    perldoc -f sleep


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, May 10, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Huey

    How to make "fork/wait" to WAIT longer?

    Huey, Mar 1, 2004, in forum: C Programming
    Replies:
    1
    Views:
    1,968
    -berlin.de
    Mar 1, 2004
  2. Markus Franz
    Replies:
    1
    Views:
    635
    Jeff Epler
    Apr 22, 2004
  3. loudking
    Replies:
    1
    Views:
    256
    Eric Sosman
    May 17, 2007
  4. Marc Heiler
    Replies:
    1
    Views:
    177
    Robert Klemme
    May 24, 2009
  5. Mark Foong

    Please Wait for Javascript Processes

    Mark Foong, Jun 30, 2003, in forum: Javascript
    Replies:
    1
    Views:
    192
    Douglas Crockford
    Jun 30, 2003
Loading...

Share This Page