From c6f4deb733d2687c6d6349d71340215bb72f18ea Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Sat, 31 Aug 2024 12:07:00 +0200 Subject: [PATCH] improved systemd service log --- hosts/yodaNas/host-specific.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hosts/yodaNas/host-specific.nix b/hosts/yodaNas/host-specific.nix index 20ec521..f7e1c7b 100644 --- a/hosts/yodaNas/host-specific.nix +++ b/hosts/yodaNas/host-specific.nix @@ -35,8 +35,20 @@ ]; script = '' set -eu -o pipefail - /jc-config/docker-compose pull - /jc-config/docker-compose up -d --wait + + # We use + # 2> >(sed 's/^/<3> /' >&2) + # to prefix each line of stderr with + # "<3> " + # Source: https://superuser.com/a/882025/919675 + # + # With this prefix, the stderr output is treated as error messages by systemd. + # See https://www.freedesktop.org/software/systemd/man/latest/sd-daemon.html + # They can be viewed with + # journalctl -b -u Jinja-Compose.service + + /jc-config/docker-compose pull 2> >(sed 's/^/<3> /' >&2) + /jc-config/docker-compose up -d --wait 2> >(sed 's/^/<3> /' >&2) ''; }; }