Click here to get back home

fork process help needed

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
fork process help needed Naren 03-15-2007
Posted by Naren on March 15, 2007, 8:56 pm
Please log in for more thread options


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


Posted by Uri Guttman on March 15, 2007, 9:17 pm
Please log in for more thread options



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

Posted by Ron Savage on March 16, 2007, 5:09 am
Please log in for more thread options


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.

Similar ThreadsPosted
Win32::Process, SetProcessAffinityMask for an existing process = perl crash May 7, 2006, 6:22 pm
Win32::Process Kill Process in Windows ME April 13, 2005, 1:49 am
platform independent fork July 18, 2004, 5:23 pm
Net::FTP help needed January 15, 2007, 9:58 pm
Help needed with XML::Smart September 23, 2004, 9:41 am
Help needed with MakeMaker August 15, 2005, 2:37 pm
Getting the name of the process via the process ID December 14, 2004, 7:14 am
Audio DSP Info needed October 18, 2004, 11:00 pm
Perl programmer needed June 22, 2006, 2:12 am
Net::Telnet - Problems using "script->waitfor" - HELP Needed November 26, 2005, 1:13 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap