From a7a6e3c01f8a14f23a78ad4fd3578b7fab7c0db1 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 5 Jan 2025 12:05:55 +0100 Subject: linde: fix rdiff-backup error handling the `remove increments` subcommand often emits warnings and returns a non-zero error code, which is ignored by the `-` prefix of the command (see systemd.service(5)) --- system/linde.nix | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/system/linde.nix b/system/linde.nix index b18015bb..29260c21 100644 --- a/system/linde.nix +++ b/system/linde.nix @@ -455,31 +455,28 @@ in systemd.services.backup-gitolite = { startAt = "daily"; path = with pkgs; [ - rdiff-backup openssh ]; - script = '' - rdiff-backup --api-version 201 backup ${config.services.gitolite.dataDir} ${hostname}@nano.${ts-domain}::gitolite - rdiff-backup --api-version 201 remove increments --older-than 3M ${hostname}@nano.${ts-domain}::gitolite - ''; - serviceConfig.Type = "oneshot"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${lib.getExe pkgs.rdiff-backup} --api-version 201 backup ${config.services.gitolite.dataDir} ${hostname}@nano.${ts-domain}::gitolite"; + ExecStartPost = "-${lib.getExe pkgs.rdiff-backup} --api-version 201 remove increments --older-than 3M ${hostname}@nano.${ts-domain}::gitolite"; + }; }; systemd.services.backup-paperless = { startAt = "daily"; path = with pkgs; [ - sudo - rdiff-backup openssh ]; - script = '' - systemd-run --machine=papers sudo -u paperless ./paperless-manage document_exporter --delete --use-filename-format --no-archive --no-thumbnail --no-progress-bar ./export - rdiff-backup --api-version 201 backup /srv/paperless/export ${hostname}@nano.${ts-domain}::paperless - rdiff-backup --api-version 201 remove increments --older-than 3M ${hostname}@nano.${ts-domain}::paperless - ''; serviceConfig = { Type = "oneshot"; WorkingDirectory = config.services.paperless.dataDir; + ExecStart = [ + "systemd-run --machine=papers sudo -u paperless ./paperless-manage document_exporter --delete --use-filename-format --no-archive --no-thumbnail --no-progress-bar ./export " + "${lib.getExe pkgs.rdiff-backup} --api-version 201 backup /srv/paperless/export ${hostname}@nano.${ts-domain}::paperless" + ]; + ExecStartPost = "-${lib.getExe pkgs.rdiff-backup} --api-version 201 remove increments --older-than 3M ${hostname}@nano.${ts-domain}::paperless"; }; }; -- cgit 1.4.1