backup module fix, it now supports multiple folders
This commit is contained in:
parent
da94e520ee
commit
cf8a2f0b74
5 changed files with 145 additions and 122 deletions
24
modules/backup/systemd-utils.nix
Normal file
24
modules/backup/systemd-utils.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
path,
|
||||
config,
|
||||
script,
|
||||
}:
|
||||
{
|
||||
timers."backup-${baseNameOf path}" = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnBootSec = "5m";
|
||||
OnCalendar = "* *-*-* 00:00:00";
|
||||
Unit = "backup-${baseNameOf path}.service";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
services."backup-${baseNameOf path}" = {
|
||||
enable = config.enable;
|
||||
description = "Saves a directory and its content.";
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${script}/bin/backup-${baseNameOf path}.sh";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue