On Mon, 2004-09-20 at 16:45, Wouter van Vliet wrote:
> > 
> > What I would like to do is fork off say 5-10 at a time and when one is
> > done start another one in its place, as they all take different length
> > of times to compleate.
> > 
> > Any clues at where to start? Here is my fork all 90+ code...
> > 
> > $sql = "SELECT * FROM locations WHERE parent = '0'";
> > $res = mysql_query($sql) or die ($sql.mysql_error());
> > while($data = mysql_fetch_array($res)){
> >        exec("/usr/local/bin/php fork.php ".$_data["id"]." > /dev/null &");
> > }
> 
> You should be able to find out about the PID's for every forked
> process, and use a loop (advisable with a sleep() in it) to see how
> many procs are still running.. When the amount drops somewhat, spawn
> another ..

Hmm, first off how would I get the PID for each process?

I could store each PID and then sleep for a minute, then check to see if
those PIDs are still valid (How would I do that?!) then fork some more
and loop till fade...

Think I will sleep on it.

John

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to