aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-03-05 19:38:07 -0800
committerFranck Cuny <franck@fcuny.net>2022-03-05 19:38:07 -0800
commitbaa67d88d2322b8b31f721d4525447c0d3164881 (patch)
tree7c9db6151f790ccc9637a3861c845785d668674e
parentprometheus: scrape nodeexporter for the rtr (diff)
downloadinfra-baa67d88d2322b8b31f721d4525447c0d3164881.tar.gz
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.
-rw-r--r--hosts/common/nas.nix1
-rw-r--r--hosts/common/server/backups/users.nix25
2 files changed, 26 insertions, 0 deletions
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"
+ ];
+ };
+ };
+}