From: Ismaƫl Bouya Date: Fri, 17 Jan 2020 00:15:21 +0000 (+0100) Subject: Remove mail command in backup script X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix%2FNUR.git;a=commitdiff_plain;h=bf510fa933d0ddaac704251ef14036fefeb44584 Remove mail command in backup script --- diff --git a/modules/rsync_backup/default.nix b/modules/rsync_backup/default.nix index dadf5e7c..a2ef0fdc 100644 --- a/modules/rsync_backup/default.nix +++ b/modules/rsync_backup/default.nix @@ -84,19 +84,16 @@ let ssh_key = config.secrets.fullPaths."rsync_backup/identity"; - backup_head = mailto: '' + backup_head = '' #!${pkgs.stdenv.shell} EXCL_FROM=`mktemp` FILES_FROM=`mktemp` TMP_STDERR=`mktemp` on_exit() { - ${lib.optionalString (mailto != null) '' - MAILTO="${mailto}" if [ -s "$TMP_STDERR" ]; then - cat "$TMP_STDERR" | ${pkgs.mailutils}/bin/mail -s "save_distant rsync error" "$MAILTO" + cat "$TMP_STDERR" fi - ''} rm -f $TMP_STDERR $EXCL_FROM $FILES_FROM } @@ -186,11 +183,6 @@ in type = lib.types.path; description = "Path to the base folder for backups"; }; - mailto = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = "E-mail to send the report to"; - }; profiles = lib.mkOption { type = lib.types.attrsOf profileModule; default = {}; @@ -223,7 +215,7 @@ in services.cron.systemCronJobs = let backup = pkgs.writeScript "backup.sh" (builtins.concatStringsSep "\n" ([ - (backup_head cfg.mailto) + backup_head ] ++ lib.mapAttrsToList backup_profile cfg.profiles)); in [ ''