PHP command line scripting multiple process forking
| From: | Walker, Roy | Date: | Thu, 21 Mar 2002 23:27:45 +0000 |
| Subject: | PHP command line scripting multiple process forking | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89609@lists.php.net to get a copy of this message | ||
I have been playing with this for a couple of days and have run into a few
issues:
I am wanting to run a set number of multiple processes (ie 25 at a time). I
can't use the exec command since it will not wait for the output (this is a
delayed response - network based).
$cmd = "/path.to/some.cmd";
$options = "--options";
$lines = file (/path.to/some.file);
while (list ($line_num, $line) = each ($lines)) {
$trimline = trim ($line);
shell_exec ("$cmd $options $trimline &");
}
This works but I want to fork it multiple times and have a set number of
lines running at a time. Anyone have any ideas?
Thank you,
Roy Walker