diff options
author | Florian Pritz <bluewind@xinu.at> | 2012-01-18 18:00:15 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2012-01-18 18:00:15 +0100 |
commit | 707ed8fac6473124d3bd13a5a12fc3cfff6aebe0 (patch) | |
tree | 1b1a37c5ab438e3d1d81003c25e4a9ea3bfe93c2 /notify-users | |
parent | b9bb6c9ac6ca2246f30733d7c26d57ff97c91edb (diff) | |
download | bin-707ed8fac6473124d3bd13a5a12fc3cfff6aebe0.tar.gz bin-707ed8fac6473124d3bd13a5a12fc3cfff6aebe0.tar.xz |
add notify-reboot and notify-users; change jabberwall to send messages
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'notify-users')
-rwxr-xr-x | notify-users | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/notify-users b/notify-users new file mode 100755 index 0000000..1b63037 --- /dev/null +++ b/notify-users @@ -0,0 +1,38 @@ +#!/bin/bash + +if [[ $# < 2 ]]; then + echo "usage: $(basename "$0") <server> <subject>" + exit +fi + +server=$1 +subject=$2 + +send_mails() { + addr_file=$1 + subject=$2 + body=$3 + from="Florian Pritz <flo@xinu.at>" + + for addr in $(cat "$addr_file"); do + msmtp -t <<EOF +Subject: $subject +From: $from +To: $addr +Date: $(date -R) + +$body + +EOF + done +} + +echo "Mail body: ^D to send" +body=$(cat) + +if [[ "$body" == "" ]]; then + body="No more information available." +fi + +jabberwall.pl ~/"docs/$server/users/jabber" "$subject" "$body" +send_mails ~/"docs/$server/users/email" "$subject" "$body" |