spawn process to run parallel

Discussion in 'Perl Misc' started by Naren, Mar 16, 2007.

  1. Naren

    Naren Guest

    I am trying to start multiple php processes from perl script ; can I
    do the following?. It is failing to launch.
    Appreciate all the help.
    #!/usr/bin/perl

    use strict;
    use warnings;

    my $count =0;
    print localtime () . ": Hello from the parent ($$)!\n";
    for ($count = 10; $count <= 100; $count = i+10) {
    my $pid = fork;

    die "Fork failed: $!" unless defined $pid;

    unless ($pid) {
    print localtime () . ": Hello from the child ($$)!\n";
    exec "/opt/php/bin/php benchmark_mysql.php $count 150 >>
    mysql_perf_cache_run$count.log"; # Some lon
    g running process.
    die "Exec failed: $!\n";
    }
    }
    print localtime () . ": Goodbye from the parent ($$)!\n";
     
    Naren, Mar 16, 2007
    #1
    1. Advertising

  2. Naren

    J. Gleixner Guest

    Naren wrote:
    > I am trying to start multiple php processes from perl script ; can I
    > do the following?. It is failing to launch.


    I'd suggest that you take a look at Parallel::ForkManager.
    It's very easy to use and it works.
     
    J. Gleixner, Mar 16, 2007
    #2
    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. Derek Basch
    Replies:
    2
    Views:
    1,307
    Donn Cave
    Jan 21, 2005
  2. Soren
    Replies:
    4
    Views:
    1,271
    c d saunter
    Feb 14, 2008
  3. Ed Hames
    Replies:
    0
    Views:
    378
    Ed Hames
    Apr 16, 2008
  4. Edgardo Hames
    Replies:
    1
    Views:
    353
    Ed Hames
    May 6, 2008
  5. Victor Hooi
    Replies:
    1
    Views:
    135
    Nobody
    Feb 10, 2013
Loading...

Share This Page