play around with popen() and stream_select()

John Wards wrote:
Hi, I have a bit of a cold today so I probably would have figured this
out for myself eventually but hey ;-)

Right I have a script that I need to run around 90 times thru a cron job
but passing a different i.d. to it each time.

I have experimented with running all 90 at once and its a no go as it
just makes the server run to slow and the session cookies I use time out
(I am doing some libcurl things).

Also running them in a loop one at a time is no use because it takes
about 8 hours.

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 &"); }

Cheers
John Wards


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



Reply via email to