diff options
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" |