:: Re: [DNG] Switching to OpenRC, incl…
Página Principal
Delete this message
Reply to this message
Autor: wirelessduck
Data:  
Para: dng
Assunto: Re: [DNG] Switching to OpenRC, including respawn

> On 14 May 2018, at 18:51, Steve Litt <slitt@???> wrote:
>
> One property of OpenRC is it has no facility to respawn a daemon when
> the old daemon crashes. Some folks like it this way, some don't, but
> it's a fact of OpenRC. Except...
>
> There are two ways to have OpenRC respawn. Way 1 is to run the daemon
> from /etc/inittab, with the "respawn" flag. Remember, OpenRC doesn't
> have its own PID1, and traditionally uses sysvinit's PID1.
>
> Way 2 is to have OpenRC run either runit or s6 from /etc/inittab with
> "respawn", and then to put all respawnable daemons in runit or s6.
> Running either runit or s6 *as a supervisor rather than an init* is
> dead-bang easy. Since about 2010 I've been doing something similar: I
> ran daemontools on top of sysvinit, and it always worked out great for
> me.
>
> SteveT


I had a closer look at OpenRC docs and noticed they now include a built-in “supervise-daemon”[1] supervisor that can be used instead of the default start-stop-daemon. It will restart a daemon if it terminates unexpectedly.

The only issue with it for my use case is that I couldn’t find any way to send an arbitrary signal to the supervised daemon without signalling it to stop. The problem being that the pidfile created exists for the individual supervisor process and not the supervised daemon process.

[1] https://github.com/OpenRC/openrc/blob/master/supervise-daemon-guide.md

—Tom