manatee: Remove stale restic locks before each backup

This commit is contained in:
Alexander Heldt committed 2026-10-15 13:38:44 +02:00
1 parent 57040a5bd8
commit 21a1039fff
1 file changed
+10 -4
+10 -4
View File
@@ -115,6 +115,12 @@ let
echo "state-backup: dump complete" echo "state-backup: dump complete"
''; '';
# A run killed mid-way (e.g. DNS dropping during an upload) leaves its lock
# behind, and every later run then fails in the pre-start "cat config"
# check. unlock only removes stale locks; "|| true" keeps a first run
# against a not-yet-initialized repo working.
backupPrepareCommand = "${pkgs.restic}/bin/restic unlock || true";
# Retention shared by all jobs. # Retention shared by all jobs.
pruneOpts = [ pruneOpts = [
"--keep-daily 1" "--keep-daily 1"
@@ -142,7 +148,7 @@ in
OnCalendar = "*-*-* 0/12:00:00"; OnCalendar = "*-*-* 0/12:00:00";
Persistent = true; Persistent = true;
}; };
inherit pruneOpts; inherit pruneOpts backupPrepareCommand;
}; };
"sync-to-cloud" = { "sync-to-cloud" = {
@@ -155,7 +161,7 @@ in
OnCalendar = "*-*-* 0/12:00:00"; OnCalendar = "*-*-* 0/12:00:00";
Persistent = true; Persistent = true;
}; };
inherit pruneOpts; inherit pruneOpts backupPrepareCommand;
}; };
# Service state (databases etc.). No timer of their own: the state-backup # Service state (databases etc.). No timer of their own: the state-backup
@@ -167,7 +173,7 @@ in
paths = [ stateDir ]; paths = [ stateDir ];
repository = "/mnt/backup/restic"; repository = "/mnt/backup/restic";
timerConfig = null; timerConfig = null;
inherit pruneOpts; inherit pruneOpts backupPrepareCommand;
}; };
"state-to-cloud" = { "state-to-cloud" = {
@@ -177,7 +183,7 @@ in
repositoryFile = config.age.secrets.restic-cloud-sync-repository.path; repositoryFile = config.age.secrets.restic-cloud-sync-repository.path;
paths = [ stateDir ]; paths = [ stateDir ];
timerConfig = null; timerConfig = null;
inherit pruneOpts; inherit pruneOpts backupPrepareCommand;
}; };
}; };