diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2017-07-31 00:23:32 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2017-07-31 00:23:32 +0200 |
commit | 6ebc6832e1939120f009eb13086e9af4d60caef7 (patch) | |
tree | 8c6d200c1d4406e837b32b31c6f7c9fbc6a33411 /custom | |
parent | 4e44fe09d315739c8553eacea1341baec08c72fe (diff) | |
download | nixos-6ebc6832e1939120f009eb13086e9af4d60caef7.tar nixos-6ebc6832e1939120f009eb13086e9af4d60caef7.tar.gz nixos-6ebc6832e1939120f009eb13086e9af4d60caef7.tar.bz2 nixos-6ebc6832e1939120f009eb13086e9af4d60caef7.tar.xz nixos-6ebc6832e1939120f009eb13086e9af4d60caef7.zip |
Better emails
Diffstat (limited to 'custom')
-rw-r--r-- | custom/unit-status-mail.nix | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/custom/unit-status-mail.nix b/custom/unit-status-mail.nix index 1b87a0b0..e07cb7b7 100644 --- a/custom/unit-status-mail.nix +++ b/custom/unit-status-mail.nix | |||
@@ -35,10 +35,11 @@ in { | |||
35 | Type = "oneshot"; | 35 | Type = "oneshot"; |
36 | }; | 36 | }; |
37 | scriptArgs = "%I \"Hostname: %H\" \"Machine-ID: %m\" \"Boot-ID: %b\""; | 37 | scriptArgs = "%I \"Hostname: %H\" \"Machine-ID: %m\" \"Boot-ID: %b\""; |
38 | path = with pkgs; [net-tools]; | ||
38 | script = '' | 39 | script = '' |
39 | #!${pkgs.stdenv.shell} | 40 | #!${pkgs.stdenv.shell} |
40 | MAILTO="${cfg.recipient}" | 41 | MAILTO="${cfg.recipient}" |
41 | MAILFROM="unit-status-mailer" | 42 | MAILFROM="unit-status-mailer@$(hostname -f)" |
42 | UNIT=$1 | 43 | UNIT=$1 |
43 | 44 | ||
44 | EXTRA="" | 45 | EXTRA="" |
@@ -46,8 +47,6 @@ in { | |||
46 | EXTRA+="$e"$'\n' | 47 | EXTRA+="$e"$'\n' |
47 | done | 48 | done |
48 | 49 | ||
49 | UNITSTATUS=$(systemctl status $UNIT) | ||
50 | |||
51 | ${config.security.wrapperDir}/sendmail $MAILTO <<EOF | 50 | ${config.security.wrapperDir}/sendmail $MAILTO <<EOF |
52 | From:$MAILFROM | 51 | From:$MAILFROM |
53 | To:$MAILTO | 52 | To:$MAILTO |
@@ -55,8 +54,7 @@ in { | |||
55 | 54 | ||
56 | Status report for unit: $UNIT | 55 | Status report for unit: $UNIT |
57 | $EXTRA | 56 | $EXTRA |
58 | 57 | $(systemctl status $UNIT) | |
59 | $UNITSTATUS | ||
60 | EOF | 58 | EOF |
61 | ''; | 59 | ''; |
62 | }; | 60 | }; |