Files
esh-pfi-infrastructure/services/zellij-fleet/zellij-fleet@.service
T

41 lines
1.8 KiB
Desktop File

# zellij-fleet@<session>.service — owns a fleet zellij SESSION SERVER in its own
# cgroup. Instance = session name: zellij-fleet@Claude.
#
# Why a unit: a zellij server forked by whatever asks for it (svos.service,
# KillMode=control-group) lands in THAT unit's cgroup, and the next restart of
# the asker SIGTERMs the server and every agent pane under it. Starting the
# server here gives it a cgroup of its own. svos-dev's seat_up starts this unit
# only when `zellij list-sessions` shows the session is not running, and never
# forks the server itself (svos seats contract).
#
# attach --create-background: creates the session if it does not exist, and
# RESURRECTS an EXITED (serialized) session with its layout, command panes HELD
# (nothing runs until someone presses Enter). If the session is already running
# (e.g. a server Prime started from an ssh login), this is a no-op that exits 0
# and that server stays in HIS scope: stopping this unit does not touch it.
#
# zsh -lc: the server gets the login environment (PATH, tokens from .zshenv /
# .zprofile), not bare systemd --user env. Interactive-only vars (.zshrc) are
# set by each pane's own interactive shell. Measured 2026-09-25: 23 vars vs 13
# bare vs 44 for the ssh-started server (the difference is SSH_*, TERM, XDG_*
# and .zshrc interactive settings).
#
# STOP = the fleet session goes down (kill-session, then the cgroup). That is
# the honest meaning of stopping it. The session stays resurrectable.
#
# Install: services/zellij-fleet/README.md
[Unit]
Description=Fleet zellij session server "%i" (own cgroup) — eshpfi services/zellij-fleet
After=default.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/zsh -lc 'exec %h/.cargo/bin/zellij attach --create-background %i'
ExecStop=-%h/.cargo/bin/zellij kill-session %i
KillMode=control-group
TimeoutStopSec=20
[Install]
WantedBy=default.target