Re: adding low level file handling stuff
| From: | Reindl Harald | Date: | Sat, 30 Apr 2011 12:54:17 +0000 |
| Subject: | Re: adding low level file handling stuff | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-52094@lists.php.net to get a copy of this message | ||
Am 30.04.2011 14:04, schrieb Ferenc Kovacs:
> Hi.
>
> recently I found a nice blogpost about how to properly daemonize a php
> daemon:
>
> http://andytson.com/blog/2010/05/daemonising-a-php-cli-script-on-a-posix-system/
> I've noticed in this article, that you can replace/redirect the
> STDIN/STDOUT/STDERR from inside of your script, you have to close them, and
> open in the correct order.
> It works (at least on linux), because the opened files will have the 1,2,3
> FDs, because the OS assign the lowest available FD, which will happen to be
> the required ones
the cleaner way is to do this in a /etc/init.d/service-script
we are running a monitoring-service written in php wilh a while(1==1)
as linux-daemon since years and even config-changes are no problem with
an internal counter for reloading them every 10 while-runs
sleep(1) is a good idea fpr each run to make sure the daemon eats not too
much ressources useless
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc