diff options
author | Alex Mekkering | 2017-07-21 15:11:17 +0200 |
---|---|---|
committer | Alex Mekkering | 2017-07-21 15:11:58 +0200 |
commit | 8be77977d0bac330b2da85194e8b7ac324a941e0 (patch) | |
tree | 9b4ebab347631dbb7876f9b95ce348f57a23498b /unit-status-mail | |
download | aur-systemd-unit-status-mail.tar.gz |
Initial commit
Diffstat (limited to 'unit-status-mail')
-rwxr-xr-x | unit-status-mail | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/unit-status-mail b/unit-status-mail new file mode 100755 index 000000000000..46fc64381c1c --- /dev/null +++ b/unit-status-mail @@ -0,0 +1,27 @@ +#!/bin/bash +MAILTO="root" +MAILFROM="unit-status-mailer" +UNIT=$1 +DATE=$(date '+%F') + +EXTRA="" +for e in "${@:2}"; do + EXTRA+="$e"$'\n' +done + +UNITSTATUS=$(journalctl -S $DATE -l -n 100000 -u $UNIT) + +sendmail $MAILTO <<ENDOFMAILCONTENT +From:$MAILFROM +To:$MAILTO +Subject:Status mail for unit: $UNIT +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset=UTF-8 + +Status report for unit: $UNIT +$EXTRA + +$UNITSTATUS +ENDOFMAILCONTENT + +echo -e "Status mail sent to: $MAILTO for unit: $UNIT" |