fix(restic): cleanup stale locks before running backups
This commit is contained in:
parent
c31a727501
commit
5928e539fb
2 changed files with 12 additions and 7 deletions
services/restic
|
@ -94,14 +94,15 @@ in {
|
||||||
];
|
];
|
||||||
timerConfig.OnCalendar = "0/6:00:00";
|
timerConfig.OnCalendar = "0/6:00:00";
|
||||||
extraPruneOpts = [ "--keep-last 4" ];
|
extraPruneOpts = [ "--keep-last 4" ];
|
||||||
};
|
|
||||||
|
|
||||||
# Extra handling for dev folder to respect .gitignore files.
|
# Extra handling for dev folder to respect .gitignore files.
|
||||||
# Do not delete `~/dev-backup` since this leads to changing ctimes
|
# Do not delete `~/dev-backup` since this leads to changing ctimes
|
||||||
# which would cause otherwise unchanged files to be backed up again.
|
# which would cause otherwise unchanged files to be backed up again.
|
||||||
# Since `--link-dest` is used, file contents won't be duplicated on disk.
|
# Since `--link-dest` is used, file contents won't be duplicated on disk.
|
||||||
systemd.services."restic-backups-full" = {
|
backupPrepareCommand = ''
|
||||||
preStart = ''
|
# remove stale locks
|
||||||
|
${pkgs.restic}/bin/restic unlock || true
|
||||||
|
|
||||||
rm -rf /home/felschr/dev-backup
|
rm -rf /home/felschr/dev-backup
|
||||||
${pkgs.rsync}/bin/rsync \
|
${pkgs.rsync}/bin/rsync \
|
||||||
-a --delete \
|
-a --delete \
|
||||||
|
|
|
@ -41,5 +41,9 @@ in {
|
||||||
];
|
];
|
||||||
timerConfig.OnCalendar = "0/6:00:00";
|
timerConfig.OnCalendar = "0/6:00:00";
|
||||||
extraPruneOpts = [ "--keep-last 4" ];
|
extraPruneOpts = [ "--keep-last 4" ];
|
||||||
|
backupPrepareCommand = ''
|
||||||
|
# remove stale locks
|
||||||
|
${pkgs.restic}/bin/restic unlock || true
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue