fork process help needed

fork process help needed

am 16.03.2007 01:56:33 von Naren

#!/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";

Re: fork process help needed

am 16.03.2007 02:17:01 von Uri Guttman

>>>>> "N" == Naren writes:

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

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

N> unless ($pid) {
N> print localtime () . ": Hello from the child ($$)!\n";

why are you posting this to clp.modules? there are no module related
things in your code. repost it to c.l.p.misc or perl.beginners

uri

--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org

Re: fork process help needed

am 16.03.2007 10:09:58 von Ron Savage

Naren wrote:

Hi Naren

You should go to CPAN at http://search.cpan.org/
and search for Net::Server.

The tests supplied with the disto will give you a good set of examples
on which you can base you code.