summaryrefslogtreecommitdiff
path: root/custom
diff options
context:
space:
mode:
Diffstat (limited to 'custom')
-rw-r--r--custom/unit-status-mail.nix8
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 };