Set HOME to private /tmp for borgbackup

borg writes to $HOME/.config but in our case it also works on $HOME (/var/vmail).

This could cause the following error when running the backup: file changed while we backed it up

This commit fixes it by setting HOME to private /tmp for borg.
This commit is contained in:
Levi Zim 2025-01-21 19:49:23 +08:00
parent dc0569066e
commit 3e4908fa0f

View File

@ -65,12 +65,16 @@ in {
description = "borgbackup"; description = "borgbackup";
unitConfig.Documentation = "man:borgbackup"; unitConfig.Documentation = "man:borgbackup";
script = borgScript; script = borgScript;
# borg writes to $HOME/.config but in our case it also works on $HOME (/var/vmail)
# Setting $HOME to /tmp to avoid it
environment.HOME = "/tmp";
serviceConfig = { serviceConfig = {
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;
CPUSchedulingPolicy = "idle"; CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle"; IOSchedulingClass = "idle";
ProtectSystem = "full"; ProtectSystem = "full";
PrivateTmp = true;
}; };
startAt = cfg.startAt; startAt = cfg.startAt;
}; };