Hello,

   Got a little issue.  Tyring ot under stand how things work but just not 
getting it.  I am forking each element of the array .  I have a maximum child 
count of 8.  Which works.  What I was wondering is if I get into the if 
statement in the until loop.  How do I exit the pid clean up and go on to the 
next element in the array with out leaving any pids around?


FORK:
        {

            HOSTID2: foreach $hostId ( @hostIds ) {
                
                #next if $CHILD_PIDS > $MAX_CHILDREN;
                redo HOSTID2 if $CHILD_PIDS >= $MAX_CHILDREN;

                if( my $pid = fork ) {
                    $CHILD_PIDS++;     #Add the children up until we hit the max
                    next;
                }elsif (defined $pid) {
                    my $failures = 0;

                    #grab quota for each user and insert into the database
                    until ( (BACKUP->QuotaIt( $hostId, $mysqluser, $mysqlpasswd ) or 
( $failures == $maxtries ) ) ) {
                        $failures++;
                        if ( $failures == $maxtries ) {              
                            #BLA BLA code

                            #clean up the pid and exit
                            exit 0;
                            waitpid(-1, &WNOHANG);
                   
                            #go to the next hostid
                            next HOSTID2;

                        } #if statememt
             
                    } #until statement

#rest of code.

Thanks for the help,

Chad

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to