Run all restic backups as root

This commit is contained in:
SebastianStork 2025-06-11 21:09:08 +02:00
parent f5e59e0d12
commit 2e53bdb015
7 changed files with 11 additions and 43 deletions

View file

@ -44,13 +44,11 @@ in
hasDependentService = dependentService != null;
in
''
${lib.optionalString hasDependentService "sudo systemctl stop ${dependentService}"}
sudo --user=${value.user} bash -c "
${value.restoreCommand.preRestore}
restic-${name} restore latest --target /
${value.restoreCommand.postRestore}
"
${lib.optionalString hasDependentService "sudo systemctl start ${dependentService}"}
${lib.optionalString hasDependentService "systemctl stop ${dependentService}"}
${value.restoreCommand.preRestore}
restic-${name} restore latest --target /
${value.restoreCommand.postRestore}
${lib.optionalString hasDependentService "systemctl start ${dependentService}"}
'';
}
);