Re: launchd / Windows NT Services analogue in Inferno
On Fri, Oct 14, 2011 at 02:13:32PM +0700, Левашев Иван wrote:
> The service is more than mere autorun. Service should be restarted on
> fail. Events should be logged. Stop/restart shouldn't be just kill and
> re-run. Some entity should process these events as it happens with
There are two ways to monitor/restart Inferno services - inside Inferno
or outside Inferno. Implementing service monitoring tool similar to
launchd/daemontools/runit in Limbo to monitor services inside Inferno
sounds like native way to go, but in my experience Limbo services work
reliable enough, and both standard Inferno apps and my own apps don't fail
often enough. Most failures crash not just one service but overall Inferno
VM - usually because of out of memory error, or some bug in Inferno itself.
Which makes "native way to go" wrong, and makes better way to go is to use
existing service monitoring tools in host OS. I'm starting all my Inferno
services under `runsvdir/runsv` (from runit) supervision. This gives me
autorun, restart on fail, and ability to add custom hooks on fail/restart.
For logging I use `socklog` (syslog-compatible daemon on custom UNIX
socket) started under same `runsv` supervision together with Inferno
service (while it's possible to log to system's syslog, I prefer to keep
logs of my services separate).
For logging from Inferno services I use syslog-compatible logger
http://code.google.com/p/inferno-contrib-logger/ to write to UNIX socket
provided by `socklog`.
Just in case, to make sure crash of any critical Inferno apps within