in reply to double fork trick vs sig chld wait
Sounds to me that you need to have a different signal handler in the top level dispatch loop and the launch script. Something like:
$SIG{CHILD} = 'IGNORE'; foreach my $job (@big_list_of_jobs) { my $pid = fork() unless( $pid ) { my $child_cleanup_func = sub { # Examine the child's output, update log files etc. }; $SIG{CHILD} = $child_cleanup_func; exec $child_cmd, @args; print "Child did not start\n"; } else { # parent # Forget about the child (launcher process from the fork above +) # move on to the next job. } }
I think it would also be a good idea to read perlipc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: double fork trick vs sig chld wait
by Voronich (Hermit) on Nov 19, 2010 at 15:57 UTC | |
by tod222 (Pilgrim) on Nov 19, 2010 at 20:03 UTC | |
by Voronich (Hermit) on Nov 19, 2010 at 20:18 UTC |