From 6cd226994dfd6edd669160ca3f954a5034d51396 Mon Sep 17 00:00:00 2001 From: Jacob Keller Date: Fri, 4 Apr 2014 15:06:46 -0700 Subject: [PATCH] send-mail-on-failure: generalize email address Rather than using a personal email address (oops!) generalize the address in the script as an argument. In addition, modify the systemd script to use root@localhost. The user *is* expected to modify the systemd script in their own copy to point to the correct address. Signed-off-by: Jacob Keller Signed-off-by: Artem Bityutskiy --- email/systemd/send-mail-on-failure.sh | 9 ++++++--- email/systemd/send-mail-on-failure@.service | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/email/systemd/send-mail-on-failure.sh b/email/systemd/send-mail-on-failure.sh index c382e4e..e8fbb0d 100755 --- a/email/systemd/send-mail-on-failure.sh +++ b/email/systemd/send-mail-on-failure.sh @@ -4,8 +4,11 @@ # Author: Jacob Keller # License: GPLv2 +service=$1 +email=$2 + ( -echo "$1 has crashed, and you need to restart it!" +echo "$service has crashed, and you need to restart it!" echo "Here is the systemctl status output:" -systemctl status -n 100 "$1" -) | mutt -s "$1 crashed!" jacob.e.keller@intel.com +systemctl status -n 100 "$service" +) | mutt -s "$service crashed!" $email diff --git a/email/systemd/send-mail-on-failure@.service b/email/systemd/send-mail-on-failure@.service index b0be9f0..8a707d1 100644 --- a/email/systemd/send-mail-on-failure@.service +++ b/email/systemd/send-mail-on-failure@.service @@ -6,4 +6,5 @@ Description=Send mail on failure of %i [Service] User=aiaiai -ExecStart=/home/aiaiai/git/aiaiai/systemd/send-mail-on-failure.sh %i +# You should customize the email address here +ExecStart=/home/aiaiai/git/aiaiai/systemd/send-mail-on-failure.sh %i root@localhost -- 2.49.0