modules/backup: support excluding paths
This commit is contained in:
parent
80cc6522da
commit
942d226099
@ -9,16 +9,17 @@
|
||||
"/var/lib"
|
||||
];
|
||||
exclude = [
|
||||
"/home/*/.local/share/Trash/"
|
||||
"/home/*/.local/share/Trash/*"
|
||||
"/home/*/.config/*.log"
|
||||
"/home/*/.local/*.log"
|
||||
"/home/*/.cache/"
|
||||
"/home/*/.config/*[Cc]ache*/"
|
||||
"/home/*/.mozilla/*/cache/"
|
||||
"/home/*/.thumbnails/"
|
||||
"/home/*/.cache/*"
|
||||
"/home/*/.config/*[Cc]ache*/*"
|
||||
"/home/*/.mozilla/*/cache/*"
|
||||
"/home/*/.thumbnails/*"
|
||||
"/home/*/.config/Element/Cache/*"
|
||||
|
||||
"/home/clerie/tmp/"
|
||||
"/home/clere/Downloads/"
|
||||
"/home/clerie/tmp/*"
|
||||
"/home/clere/Downloads/*"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
@ -40,14 +40,17 @@ let
|
||||
|
||||
export RESTIC_PASSWORD_FILE=${jobPasswordFile}
|
||||
export RESTIC_REPOSITORY="rest:https://${targetUsername}:$(cat ${targetPasswordFile})@${targetOptions.serverName}${repoPath}"
|
||||
export RESTIC_PROGRESS_FPS=0.1
|
||||
|
||||
restic snapshots || restic init
|
||||
|
||||
restic backup ${optionalString (jobOptions.exclude != []) (pkgs.writeText "clerie-backup-${jobName}-${targetName}-excludes" (concatStringsSep "\n" jobOptions.exclude))} ${escapeShellArgs jobOptions.paths}
|
||||
restic backup ${optionalString (jobOptions.exclude != []) "--exclude-file ${pkgs.writeText "clerie-backup-${jobName}-${targetName}-excludes" (concatStringsSep "\n" jobOptions.exclude)}"} ${escapeShellArgs jobOptions.paths}
|
||||
|
||||
restic check
|
||||
|
||||
${optionalString (config.clerie.monitoring.enable) ''
|
||||
echo "clerie_backup_last_successful_run_time{backup_job=\"${jobName}\", backup_target=\"${targetName}\"} $(date +%s)" > /var/lib/prometheus-node-exporter/textfiles/clerie-backup-${jobName}-${targetName}.prom
|
||||
''}
|
||||
'';
|
||||
}
|
||||
) jobTargetPairs);
|
||||
|
Loading…
Reference in New Issue
Block a user