From ddad276bf357c7fa19850181f17cb92464c9a11f Mon Sep 17 00:00:00 2001 From: Mel Date: Sun, 6 Sep 2026 21:42:24 +0200 Subject: Service should survive transient failures, retries, and ordering Signed-off-by: Mel --- module.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'module.nix') diff --git a/module.nix b/module.nix index b227085..de2f20d 100644 --- a/module.nix +++ b/module.nix @@ -72,12 +72,23 @@ in config = mkIf cfg.enable { systemd.services.ddnnss = { description = "ddnnss dynamic dns update cycle"; - after = [ "network-online.target" ]; + after = [ + "network-online.target" + "nss-lookup.target" + ]; wants = [ "network-online.target" ]; + unitConfig = { + # retry on transient failure + StartLimitIntervalSec = "10min"; + StartLimitBurst = 3; + }; + serviceConfig = { Type = "oneshot"; DynamicUser = true; + Restart = "on-failure"; + RestartSec = "30s"; LoadCredential = lib.mapAttrsToList (name: path: "${name}:${path}") cfg.credentials; ExecStart = "${getExe ddnnss} -config ${configFile}"; @@ -88,7 +99,7 @@ in wantedBy = [ "timers.target" ]; timerConfig = { # wait 2 minutes from the start, with 30 second jitter. - OnBootSec = "2min"; + OnActiveSec = "2min"; RandomizedDelaySec = "30s"; OnUnitActiveSec = cfg.interval; }; -- cgit v1.3.1