Revert "Check that the server exists before starting backups"

This reverts commit 459e74b01a.
This commit is contained in:
Andreas Zweili 2023-12-31 17:25:24 +01:00
parent cac1914b0f
commit be310b4627
1 changed files with 13 additions and 19 deletions

View File

@ -2,8 +2,7 @@
let
cfg = config.services.az-restic-client-desktop;
password_file = config.age.secrets.resticKey.path;
backup_server = "10.7.89.30";
repository = "rest:http://${backup_server}:8000";
repository = "rest:http://10.7.89.30:8000";
in
{
options = {
@ -45,24 +44,19 @@ in
};
onFailure = [ "unit-status-telegram@%n.service" ];
script = ''
# first make sure we can reach the backup server
if ${pkgs.iputils}/bin/ping -c 1 ${backup_server} >/dev/null; then
${pkgs.restic}/bin/restic \
--exclude-file=${inputs.self}/modules/misc/restic-client/excludes.txt \
--tag home-dir \
backup /home/${config.az-username}
${pkgs.restic}/bin/restic \
--exclude-file=${inputs.self}/modules/misc/restic-client/excludes.txt \
--tag home-dir \
backup /home/${config.az-username}
${pkgs.restic}/bin/restic \
forget \
--host ${config.networking.hostName} \
--keep-hourly 25 \
--keep-daily 7 \
--keep-weekly 5 \
--keep-monthly 12 \
--keep-yearly 2 \
else
echo "Backup server unreachable."
fi
${pkgs.restic}/bin/restic \
forget \
--host ${config.networking.hostName} \
--keep-hourly 25 \
--keep-daily 7 \
--keep-weekly 5 \
--keep-monthly 12 \
--keep-yearly 2 \
'';
};
};