>This is what I did before, but in an effort to make the "sub-supervision-tree"
>independent of whatever init-system/service manager is used for the main tree,
>I tried what I described.
Well, it's not very satisfying, but I understand the wish, so here
is how I do it on Alpine Linux. You can take inspiration from it:
https://gitlab.alpinelinux.org/alpine/aports/-/raw/master/main/s6/s6-svscanboot
This is invoked by openrc in order to start a new supervision tree.
OpenRC doesn't provide any native logging infrastructure, so the
script creates its own catch-all logger. The fd dance is similar to
what s6-linux-init does. Killing s6-svscan *should* also make the
catch-all logger die on its own. (It was buggy in previous versions,
but with the current version of s6, it should work).
Note that /dev/console is explicitly mentioned towards the end,
because openrc doesn't provide an open fd to it to its services. If
you want your script to be portable to any service manager, you should
probably do the same. Else, you could try saving the script's stderr
instead, and making it s6-svscan's console holder, but that requires
a little more fd dancing, and that won't work with OpenRC or other
service managers that don't give you a suitable stderr fallthrough.
--
Laurent
Received on Tue Dec 03 2024 - 01:56:31 CET