Re: s6 talk at FOSDEM 2017: video

From: Olivier Brunel <>
Date: Tue, 7 Feb 2017 13:15:06 +0100

On Mon, 06 Feb 2017 22:44:07 +0000
"Laurent Bercot" <> wrote:

> I'm obviously partial to s6-rc since it's the one I wrote :) and I'm
> especially proud of the fact that it runs oneshots with the same
> reproducible launch guarantees that it runs longruns with - something
> *no* other service manager does (except integrated init systems since
> those get everything started by pid 1 anyway).

Yeah, it's true that anopa doesn't get that "out of the box", however
it's easy enough to get there: one just needs to create a longrun
service to process start/stop commands, e.g. have a servicedir
aa-command that looks something like:

% cat run
#!/usr/bin/execlineb -P
fdmove -c 2 1
fdmove -c 4 1
fdmove 1 3
s6-ipcserver -1 -- socket
s6-ipcserver-access -i rules --
fdmove 2 4
s6-sudod -2

% cat aa-command
#!/usr/bin/execlineb -s1
ifelse -n { test $1 = start -o $1 = stop -o =1 = reset }
{ if { aa-echo -De "Invalid command: $1" } exit 1 }
if { aa-echo -Dn +w "Running: " +b "aa-${1} $_at_" }
exec aa-${1} -D $_at_

And voilĂ ! :) Now to start foobar you'd just do e.g:
s6-sudo /run/services/aa-command/socket start foobar

And aa-start will run in the same predictable environment. In fact,
you could say that's indeed the proper way to do it, and I should add a
note about it in the documentation.

Thing is, I've always thought of anopa as a set of tools, that allow
you to set things up however you want. I like that idea, and so that's
why it doesn't create service(dir)s on its own, unlike s6-rc.

So I'm not sure I want to include a servicedir for aa-command as
described above, bugs me somehow; Just like I know s6-rc has a nice
interface to set up a pipe between services, and that's of course
doable easily w/ anopa, though "less easily" since you need to provide
the e.g. pipe_at_ & fdholderd servicedirs yourself.

OTOH anopa does come with aa-stage{0..4} scripts, that's true. Somehow
that doesn't really bother me, even if I also think of those more as
examples than anything else (although they're usable as-is w/out issue,
I do so myself.)

Anyhow, that's how one can use anopa and have it run oneshots with the
same reproducible launch guarantees that it runs longruns with. :)

Received on Tue Feb 07 2017 - 12:15:06 UTC

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