Expand description
Linux systemd user-unit integration for omni-dev daemon start / stop
and socket activation — the Linux mirror of the macOS launchd module.
start writes a socket-activated .socket + .service pair under
~/.config/systemd/user/ and enables the socket. Like the launchd model this
is socket-activated: systemd owns the control socket (declared in the
.socket unit’s ListenStream) and spawns omni-dev daemon run the first
time a client connects, handing it the listening file descriptor via the
sd_listen_fds protocol ([systemd_listener]). There is no Restart= —
on-demand activation is the model, so a crashed daemon is re-activated on
the next connect for free, and enable-ing the socket into sockets.target
is what makes it come up at login. A clean daemon stop stops and disables
the socket so the daemon stays down. See ADR-0039 and issue #1174.
When systemd is not managing the session (containers, non-systemd distros, or
the OMNI_DEV_DAEMON_DISABLE_SYSTEMD escape hatch), is_available returns
false and the caller falls back to the detached-spawn launcher.
Constants§
- SERVICE_
UNIT - The socket-activated
.serviceunit filename. - SOCKET_
UNIT - The demand-activating
.socketunit filename.
Functions§
- install_
and_ load - Writes the unit files and enables the socket so systemd listens on the demand socket and spawns the daemon on the first client connect (and at login).
- is_
available - Whether a systemd user manager is running and can host the daemon.
- unload
- Stops and disables the socket (and stops any running daemon) so it is not re-activated on the next client connect or at the next login.