add borg lock mechanism
This commit is contained in:
parent
5936f7d0a7
commit
8d74aeac0b
1 changed files with 10 additions and 1 deletions
|
|
@ -162,11 +162,20 @@ in
|
|||
# Add borg and required tools to the service's PATH
|
||||
path = [ pkgs.borgbackup pkgs.openssh pkgs.curl ];
|
||||
|
||||
# Prevent concurrent backup runs
|
||||
unitConfig = {
|
||||
ConditionPathExists = "!/var/run/borg-backup.lock";
|
||||
};
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root"; # Need root to access all backup paths
|
||||
Group = "root";
|
||||
|
||||
# Create lock file on start, remove on stop
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/touch /var/run/borg-backup.lock";
|
||||
ExecStopPost = "${pkgs.coreutils}/bin/rm -f /var/run/borg-backup.lock";
|
||||
|
||||
# Security settings
|
||||
PrivateTmp = true;
|
||||
ProtectSystem = "strict";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue