|
Posted by Andy Jeffries on 04/25/06 01:24
On Mon, 24 Apr 2006 14:45:34 -0700, fletch wrote:
>> For anyone interested, a working function to become a Daemon (background
>> task, unattached from the parent process) from a PHP CLI script is:
>
> <sinp code>
>
> this is useful code but I would like to point out that a daemon should
> automatically restart when it dies unexpectedly, and ensure that only one
> instance is running, not covering these cases is usally a bad thing. It
> depends what the daemon does of course.
Absolutely, daemon probably isn't the right word, fully detached process
would probably be better.
Although Apache is a daemon, but if the main apache process dies then it
won't automatically restart by itself will it (it relies on
start-stop-daemon or the like).
Anyway, thought the code may help someone in the future.
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
Navigation:
[Reply to this message]
|