Skip to content

Commit

Permalink
contrib/systemd/labgrid-coordinator: improve service
Browse files Browse the repository at this point in the history
Adding `PYTHONUNBUFFERED=1` [1] to the environment forces the stdout and
stderr streams to be unbuffered, so all logs end up in the journal
instantly.

Add a hint where to get a config template from.

Soften the restart criteria by using `on-failure` instead of `on-abort`,
which covers more failure scenarios, see [2].

[1] https://docs.python.org/3/using/cmdline.html#envvar-PYTHONUNBUFFERED
[2] https://www.freedesktop.org/software/systemd/man/systemd.service.html#Restart=

Signed-off-by: Bastian Krause <[email protected]>
(cherry picked from commit 1e24d60)
  • Loading branch information
Bastian-Krause committed Apr 16, 2024
1 parent f957d20 commit ec5402a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contrib/systemd/labgrid-coordinator.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ Description=Labgrid Coordinator
After=network.target

[Service]
Environment="PYTHONUNBUFFERED=1"
# labgrid's .crossbar/config-anonymous.yaml serves as an example
ExecStart=/path/to/labgrid-coordinator/venv/bin/crossbar start --logformat=syslogd --cbdir /var/lib/labgrid-coordinator --config /etc/labgrid/coordinator.yaml
ExecStop=/usr/bin/labgrid-coordinator stop --cbdir /var/lib/labgrid-coordinator
Restart=on-abort
Restart=on-failure
DynamicUser=yes
StateDirectory=labgrid-coordinator

Expand Down

0 comments on commit ec5402a

Please sign in to comment.