Re: How to use s6 and s6-rc together

From: Luis Ressel <aranea_at_aixah.de>
Date: Fri, 19 May 2017 00:02:00 +0200

On Thu, 18 May 2017 16:28:17 -0500
Robert Hill <hilljamesrobert_at_gmail.com> wrote:

> The overview for s6-rc
> <http://skarnet.org/software/s6-rc/overview.html> mentions that:
>
> > the chosen init should make sure that a s6 supervision tree is up
> > and running. s6-rc will only work if there is an active s6-svscan
> > process monitoring a scan directory.
>
> This is a little confusing to me, and I am sure I am not understanding
> correctly. If s6-svscan is monitoring a scan directory, won't all the
> processes in that scan directory already have been started by the
> s6-supervise instances that get started by s6-svscan? I would like to
> use s6-rc to start all services and s6 to supervise them once started.

Yes, when your init exec's into s6-svscan, it will immediately start all
services in the scandir (unless the corresponding servicedir contains
a down file).

However, the scandir will typically be empty at this point (it may
contain an early getty service). It is only populated with services
once you call s6-rc-init (to be exact, s6-rc-init creates the
servicedirs in /run/s6-rc/servicedirs and then symlinks them into the
scandir). s6-svscan will still not start the services, though, since
all the servicedirs created by s6-rc-init will contain a down file.
They will only be started once you call s6-rc -u change ok-all (ok-all
being the s6-rc bundle containing all your services).

Have you checked out the s6-linux-init package? It will generate an
init script that takes care of all the subtleties required to start
s6-svscan and kick of s6-rc. The only thing you still have to do by
yourself it writing the actual s6-rc services (and the s6-rc package
contains an example/ dir you can use as a reference for that).

> The page for s6-supervise
> <http://skarnet.org/software/s6/s6-supervise.html> indicates that it
> will only start services if the default service state is up. Does
> that imply that the default service state for all services with
> dependencies should be down, so that they do not get started when
> s6-svscan is run (thus enabling s6-rc to start them according to the
> dependency graph)?

Yes, the default state for all services managed by s6-rc should be
"down". But that doesn't mean you have to drop a down file in every
service directory; as I mentioned above, s6-rc-init will automatically
take care of that when it copies the servicedirs over to the /run
filesystem.

Cheers,
Luis Ressel



Received on Thu May 18 2017 - 22:02:00 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC