fix netcup-dns systemd service

This commit is contained in:
Daniel Langbein 2023-12-12 16:32:36 +01:00
parent 04503b1dca
commit 3a28cd3f53
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002

View File

@ -64,7 +64,19 @@ in
User = "netcup-dns";
Nice = 19;
IOSchedulingClass = "idle";
ExecStart = "${pkgs.python3.withPackages my-python-packages}/bin/netcup-dns";
# Create directory `/run/netcup-dns`.
# `netcup-dns` uses it for caching.
# For systemd to create this directory automatically, `PermissionsStartOnly` is required: https://unix.stackexchange.com/questions/354583/how-to-automatically-create-a-runtime-folder-with-a-systemd-service-or-tmpfiles#comment628290_354583
RuntimeDirectoryMode = "0755";
RuntimeDirectory = "netcup-dns";
PermissionsStartOnly = true;
# Since we use `/run/netcup-dns` for caching between subsequent runs of `netcup-dns`, it should be kept and not deleted.
# Man page section `RuntimeDirectoryPreserve`:
# If set to yes, then the directories are not removed when the service is stopped. Note that since the runtime directory /run/ is a mount point of "tmpfs", then for system services the directories specified in RuntimeDirectory= are removed when the system is rebooted.
RuntimeDirectoryPreserve = true;
ExecStart = "${pkgs.python3.withPackages my-python-packages}/bin/netcup-dns --cache-directory /run/netcup-dns";
};
};
}