[lug] Running a PHP script as a daemon

Sean Reifschneider jafo at tummy.com
Thu May 18 00:45:28 MDT 2006


On Wed, May 17, 2006 at 11:34:36AM -0600, Hugh Brown wrote:
>Two thoughts, write an /etc/init.d/phpxmldaemonwhodad script that
>starts/stops/restarts your process.  Set it to run out of /etc/inittab

That won't automatically restart it if it dies.  Under SMF, the Solaris
init.d replacement, it will, but not under /etc/init.d.  DJB's alternative
is called daemontools, but it actually tries too hard.  It will tight-loop
restart a service that is failing because of configuration issues, causing
100% CPU load.  Not good.  SMF I don't know about in that case, but it's
pretty sweet in other cases I've played with.

Another friend of mine just recently wrote a service restart system for, as
far as I can tell, Python apps.  It will try restarting the service until
it declares that the patient is dead.  Then it will try rebooting the box,
and if that doesn't do it it declares the patient stupid.

The discussion in the IRC channel then went along examining the position
that stupidity was worse than death, by observing that not even black magic
proposes a solution to stupidity.

Thanks,
Sean
-- 
 These go to eleven.
                 -- _This_is_Spinal_Tap_
Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995: Ask me about High Availability




More information about the LUG mailing list