On 5/4/07, Steve Pittman <[EMAIL PROTECTED]> wrote:
I would be interested in a reference for PID monitoring for cases where we have more that one *identical* spawned process to consider*
Maybe you want something like POE? http://search.cpan.org/author/RCAPUTO/POE-0.9989/lib/POE.pm But here's one idea of how multiple processes could be monitored by a Perl loop: while (1) { my $did_stuff = 0; # starts out false if (...there are dead procs...) { ...reap dead procs... $did_stuff++; } if (...more procs are needed...) { ...spawn new procs... $did_stuff++; } redo if $did_stuff; sleep 30; # nothing to do } There are details hidden in the blanks. For one, programs that launch many processes at once can easily tie up your system. I'd make the code that tells whether "more procs are needed" check whether some process is being respawned many times in the last few seconds, and perhaps consider whether I'd recently forked off several new processes as part of the decision. Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/