Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contrib/systemd/labgrid-exporter: improve service
The labgrid exporter needs to talk to the coordinator (crossbar), so start after the network-online.target instead of after the network.target. Also add a weak requirement for that target to make sure it is actually started. 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. Try to read environment variables from `/etc/environment`. This is the place where `LG_CROSSBAR` should be defined. Don't fail if that file does not exist, though. Soften the restart criteria by using `on-failure` instead of `on-abort`, which covers more failure scenarios, see [2]. The exporter exits with exit code 100 if it loses the connection to the coordinator. While this is already covered by `on-failure`, add it nonetheless for documentation purposes and users that might adjust `Restart=`. Also increase the time to sleep before restarting the exporter on failure to prevent system load on failure loops. Replace explicit `User=`/`Group=` by `DynamicUser=yes`. The labgrid user might not exist and there is no requirement for a specific user anyway. Since the exporter does not write any state, drop `CacheDirectory=`/`CacheDirectoryMode=` altogether. The caching directories on the exporter host are created by labgrid's `contrib/systemd/tmpfiles.d/labgrid.conf`. This directory is used by labgrid's ManagedFile, which is not part of the exporter. [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 0a2deef)
- Loading branch information