in reply to Daemonized with max processes

Hi,

You should use a reaper, the following snippets should get you started:
use POSIX; use constant MAX_CHILDS => 6; my $CHILD_COUNT = 0; $SIG{CHLD} = \&Reaper; sub Reaper { my $childPid; while (($childPid = waitpid(-1, &WNOHANG)) > 0) { $CHILD_COUNT--; } $SIG{CHLD} = \&Reaper; } if ($CHILD_COUNT < MAX_CHILDS) { my $pid; if (!defined($pid = fork())) { # Fork failed } # Child process elsif ($pid == 0) { # Process file } # Parent process else { $CHILD_COUNT++; } }