James,

   I an tarring up different directories.  Directories that may be in
home or maybe in another location.  The directories in home are @users
and the directories in another location are @otherusrs.  The thing is
the directories in the other location might not exist.  
    I read that before forking another process you should wait a few
before forking a new one..

--chad


On Thu, 2002-09-26 at 10:17, Kipp, James wrote:
>  
> > foreach my $usr (@users) {
> >       my $UsrPid;
> >       unless ($UsrPid = fork) {
> >             while fork {
> >                   do stuff
> >                   exit 0;
> >             }
> >             exit 0;
> >        }
> >        waitpid($UsrPid,0);
> > } 
> > if (defined @otherusers)
> >       foreach my $usr2 (@otherusers) {
> >             my $oUsrPid;
> >             unless ($oUsrPid = fork) {
> >                    while fork {
> >                           do stuff
> >                           exit 0;
> >                    }
> >                    exit 0;
> >              }
> >              exit 0;
> >        }
> >        waitpid($oUsrPid,0);
> > }
> 
> What are you trying to do here? what is the distinction between @users and
> @otherusers ?Not sure you need all this code. Did you want to include the if
> (...) in the foreach loop ?
> 
> foreach my $usr (@users) {
>        my $UsrPid;
>        if ($UsrPid = fork) { exit }; #exit parent
>        elseif ($UserPid) { do stuff .... }
>        else { die "bad fork .. $!" }
>        
> # now, what do you want to with this ? waitpid waits for the child to exit
> is 
> # this  what you want to do ? or did you want the current child to go onto
> your
> # if statement below.      
>         waitpid($UsrPid,0);
> } 
> > if (defined @otherusers)
> >       foreach my $usr2 (@otherusers) {
> >             my $oUsrPid;
> >             unless ($oUsrPid = fork) {
> >                    while fork {
> >                           do stuff
> >                           exit 0;
> >                    }
> >                    exit 0;
> >              }
> >              exit 0;
> >        }
> >        waitpid($oUsrPid,0);
> > }
> 
> 
> > 
> >     This is in a sub routine.  But after it does stuff with $Usr it
> > exists out of the sub and goes to the next one.  IT does not contiue
> > with the if (define @otherusers).
> 
> THAT is because you code is telling it to that :-)
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
-- 
Chad Kellerman
Jr. Systems Administrator
Alabanza Inc
410-234-3305

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to