From 53a4cddd7c84f5de6bc3385eb24088178044a602 Mon Sep 17 00:00:00 2001 From: Christopher Bacher Date: Mon, 17 Oct 2022 01:49:54 +0200 Subject: [PATCH] modules(pihole-container): add sleep in `ExecStopPost=` to force a wait This is necessary because podman-stop did not wait until the container was actually deleted and `RestartSec=` does not apply if the service is restarted by systemd itself (via restart). RestartSec only applies if the restart reason is covered by `Restart=` --- modules/pihole-container.factory.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/pihole-container.factory.nix b/modules/pihole-container.factory.nix index e6fefe1..acf2fb7 100644 --- a/modules/pihole-container.factory.nix +++ b/modules/pihole-container.factory.nix @@ -340,10 +340,7 @@ in rec { } \ docker-archive:${piholeFlake.packages.${pkgs.system}.piholeImage} ''; - ExecStop = '' - ${pkgs.podman}/bin/podman stop ${cfg.hostConfig.containerName} - ''; - RestartSec = "5s"; + ExecStopPost = "${pkgs.coreutils}/bin/sleep 30"; #TODO check that user can control podman & has subuidmap/subgidmap set User = "${cfg.hostConfig.user}"; };