Send Telegram notifications on failure

This commit is contained in:
Andreas Zweili 2022-08-27 17:15:05 +02:00
parent 5e86f7723a
commit a5740499f7
1 changed files with 5 additions and 0 deletions

View File

@ -43,6 +43,10 @@ let
${pkgs.restic}/bin/restic --password-file ${password_file} mount /tmp/restic'';
in
{
imports = [
"${inputs.self}/modules/telegram-notifications"
];
systemd.timers."restic-backups-${custom.username}" = {
wantedBy = [ "timers.target" ];
partOf = [ "restic-backups-${custom.username}.service" ];
@ -62,6 +66,7 @@ in
RESTIC_PASSWORD_FILE = password_file;
RESTIC_REPOSITORY = repository;
};
onFailure = [ "unit-status-telegram@%n.service" ];
script = ''
${pkgs.restic}/bin/restic \
--exclude-file=${inputs.self}/modules/restic/excludes.txt \