From baa67d88d2322b8b31f721d4525447c0d3164881 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 5 Mar 2022 19:38:07 -0800 Subject: backups: unit to run maintenance on my backups This will be run via a timer once a day, to perform maintenance on my backups on the nas. --- hosts/common/nas.nix | 1 + hosts/common/server/backups/users.nix | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 hosts/common/server/backups/users.nix (limited to 'hosts') diff --git a/hosts/common/nas.nix b/hosts/common/nas.nix index 255e95e..92b0d3f 100644 --- a/hosts/common/nas.nix +++ b/hosts/common/nas.nix @@ -6,5 +6,6 @@ ./server/samba.nix ./server/prometheus.nix ./server/grafana.nix + ./server/backups/users.nix ]; } diff --git a/hosts/common/server/backups/users.nix b/hosts/common/server/backups/users.nix new file mode 100644 index 0000000..d56f7fe --- /dev/null +++ b/hosts/common/server/backups/users.nix @@ -0,0 +1,25 @@ +{ config, ... }: + +{ + + systemd.services.backups-maintenance-fcuny = { + Unit = { + Description = "maintenance for fcuny backups"; + Documentation = "man:restic(1)"; + }; + Service = { + Type = "oneshot"; + User = "restic"; + ReadWritePaths = "/data/slow/backups/users/fcuny"; + Environment = [ + "RESTIC_REPOSITORY=/data/slow/backups/users/fcuny" + "RESTIC_PASSWORD_FILE=" + ]; + ExecStart = [ + "${pkgs.restic}/bin/restic --verbose rebuild-index" + "${pkgs.restic}/bin/restic --verbose prune" + "${pkgs.restic}/bin/restic --verbose forget --prune --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --keep-yearly 3" + ]; + }; + }; +} -- cgit 1.4.1