Would you be willing to try a manual fork method?
For instance:
or maybe try the following, remembering to try system(1,$cmd) instead of exec( $cmd)#!/usr/bin/perl #by Zaxo of perlmonks my @apps = ( [qw(/path/to/foo args of foo)], [qw(/path/to/bar args of it here)] ); #to avoid Zombies $SIG{CHLD} = 'IGNORE'; for (@apps) { defined(my $cpid = fork) or die $!; $cpid or exec {$_->[0]} @$_ or die $!; } exit 0; # the parent #If the apps don't run as daemons, you may need to have #them ignore SIGHUP or else call &POSIX::setsid so that #the parent's exit doesn't trigger an early demise of the kids.
#!/usr/bin/perl my $child=fork(); # Spawn off a child if ($child>0) { #parent exec ($app1) || die "Could not exec $app1:$!"; exit(0); # Should never get here! } elsif ($child == 0 ) { # Child process exec ($app2) || die "Could not exec $app2:$!"; exit(0); # should never get here either } else { die "Could not fork! $!"; } # Evaluating $! will give you the reason you couldn't # spawn the exec'ed process.
In reply to Re^5: Adding parallel processing to a working Perl script
by zentara
in thread Adding parallel processing to a working Perl script
by Jim
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |