From 97d151dabdac2143b6012d4583691e13276d4c37 Mon Sep 17 00:00:00 2001 From: missytake Date: Fri, 1 Dec 2023 16:21:43 +0100 Subject: [PATCH] pyinfra: enable-linger is necessary for systemd user units --- src/teams_bot/pyinfra.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/teams_bot/pyinfra.py b/src/teams_bot/pyinfra.py index 30a0305..61497aa 100644 --- a/src/teams_bot/pyinfra.py +++ b/src/teams_bot/pyinfra.py @@ -79,6 +79,12 @@ def deploy_teams_bot( unix_user=unix_user, bot_email=bot_email, ) + + server.shell( + name=f"enable {unix_user}'s systemd units to auto-start at boot", + commands=[f"loginctl enable-linger {unix_user}"], + ) + systemd.daemon_reload( name=f"{unix_user}: load teams-bot systemd service", user_name=unix_user,