in reply to Re: creating multiple instances of a process
in thread creating multiple instances of a process
I get no errors but only one instance runs. I need four independant instances running and as you can see by code they should each run in their own directory. The delme.pl is trivial, essentially just printing a line to STDOUT as well as STDERR, then sleeping for 25 seconds.#!/usr/bin/perl -w use strict; chomp (my $curdir = `pwd`); my $proc = '../delme.pl > proc.log 2>error.log'; my %kid; for (1 .. 4) { chdir $curdir; do { mkdir "test$_" or die $! } unless (-d "test$_"); chdir "test$_" or die $!; print "Launching: Process $_$/"; defined(my $cpid = fork) or warn $! and next; $kid{$cpid} = undef, next if %kid; exec $proc; exit 0; } delete $kid{wait()} while %kid; print "Done...$/";
Thanks for your help!
Sweetblood
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: creating multiple instances of a process
by Zaxo (Archbishop) on Jun 20, 2005 at 18:32 UTC | |
by sweetblood (Prior) on Jun 20, 2005 at 19:55 UTC |