Implementing a helper for systemd's LISTEN_* environment variables using execline

From: Carlos Eduardo <carana2099_at_gmail.com>
Date: Thu, 28 Oct 2021 10:59:58 -0300

I'm supervising the gpg-agent daemon using s6. Unfortunately, the only
official way of getting it to cooperate with a supervision suite is by
pre-opening sockets and passing information about them through
systemd's LISTEN_* (LISTEN_PID, LISTEN_FDS, LISTEN_FDNAMES)
environment variables. It'll only open the sockets itself if you pass
an argument that will background it. Thankfully it does not link
against libsystemd, and therefore s6 has all the tools needed to
fulfill this requirement.

The run script ended up being quite verbose due to all the
s6-ipcserver-socketbinder'ing, so I thought of writing a helper. The
usage I envisioned would be:

socket-helper { name1 /run/name1.socket name2 /run/name2.socket } prog

Currently socket-helper is a shell script, as I haven't found a way to
generate the unknown number of `s6-ipcserver-socketbinder /path/sock
fdmove N 0` using just execline. Is this socket-helper (or an
easier-to-implement analogue of it) possible in execline? I know
`getpid` allows a one-line implementation of the first environment
variable, but I'm at a loss on how to implement the last two.
Received on Thu Oct 28 2021 - 15:59:58 CEST

This archive was generated by hypermail 2.4.0 : Thu Oct 28 2021 - 15:59:45 CEST