RE: [PHP] How reliable is pcntl support?
| From: | Darren Gamble | Date: | Fri, 26 Jul 2002 15:16:14 +0000 |
| Subject: | RE: [PHP] How reliable is pcntl support? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-109747@lists.php.net to get a copy of this message | ||
Good day,
Thanks for your reply.
> > I've recently had a need to write a standalone script that
> > needs to fork off
> a number of children during its operation,
> If by children you mean server processes or OS processes you
> may be able to
> use exec() or one of it's variations;
I had considered trying to use something like exec(), but it would have to
be written a lot differently. Perhaps the group could give some
suggestions?
I need to write a rrdtool front-end that will query a series of hosts and
collect information so that graphs can be created for them. All of the
information I need is in LDAP, which I've already written neat little
functions to retrieve them and process the hosts and "services" which
represents the graphs.
So, the program needs to get the information out of LDAP, collect the data
sources for rrdtool for each graph (for those not familiar with it, rrdtool
doesn't collect the information for you) and then call rrdtool to update the
graphs and create the graph files for new graphs, if necessary.
Now, a single-threaded process wouldn't be able to poll all of the graphs in
time (most of the time is spent waiting for all of the SNMP replies), so I'd
like to have the main program fork off children to actually perform the
work. At least, that's the best way I can think of to do it.
The only way I can think of do this without forking is to start up
completely separate processes that do the polling, and somehow have them
independently figure out which hosts/graphs in LDAP that it has been
"assigned" to poll.
I wrote something similar in Perl for MRTG a couple of years ago that had a
MySQL backend, but after using rrdtool I am not going back to MRTG. =) Perl
would work nicely for what I want to do, but a lot of it is already done in
PHP and it would sure be nice to share includes between the two
applications.
There's the program. What would people suggest?
============================
Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948