summaryrefslogtreecommitdiff
path: root/hostnix
diff options
context:
space:
mode:
Diffstat (limited to 'hostnix')
-rw-r--r--hostnix/elmo/dyndns.nix12
-rw-r--r--hostnix/elmo/system.nix5
2 files changed, 13 insertions, 4 deletions
diff --git a/hostnix/elmo/dyndns.nix b/hostnix/elmo/dyndns.nix
index 5abe98c..33ce19d 100644
--- a/hostnix/elmo/dyndns.nix
+++ b/hostnix/elmo/dyndns.nix
@@ -27,15 +27,19 @@
after = [ "network-online.target" ];
unitConfig = {
AssertPathExists = "/var/secrets/dyndns";
- # Defer errors for ~45min, throttle e-mails to ~hourly.
- StartLimitIntervalSec = "1hr";
- StartLimitBurst = "45";
+ # Retry ~3min before giving up.
+ StartLimitIntervalSec = "5min";
+ StartLimitBurst = "7";
OnFailure = "status-email@%n.service";
};
serviceConfig = {
Type = "oneshot";
Restart = "on-failure";
- RestartSec = "1min";
+ # Restart must be faster than the regular timer interval to exceed the
+ # start limit when flapping.
+ RestartSec = "30";
+ # Defer OnFailure until after retries.
+ RestartMode = "direct";
};
path = [ pkgs.dnsutils pkgs.gawk pkgs.iproute2 ];
scriptArgs = config.networking.fqdn;
diff --git a/hostnix/elmo/system.nix b/hostnix/elmo/system.nix
index 23a6aa6..d98d1ff 100644
--- a/hostnix/elmo/system.nix
+++ b/hostnix/elmo/system.nix
@@ -56,6 +56,11 @@
# https://wiki.archlinux.org/index.php/Systemd/Timers#MAILTO
systemd.services."status-email@" = {
description = "Status email for %i";
+ unitConfig = {
+ # Throttle notifications to twice daily.
+ StartLimitIntervalSec = "12hr";
+ StartLimitBurst = "1";
+ };
serviceConfig = {
Type = "oneshot";
};