2014-04-27 03:03:14 +02:00
|
|
|
#!/bin/bash
|
2017-12-03 15:43:22 +01:00
|
|
|
|
|
|
|
if [ -z "$ERESSEA" ]; then
|
|
|
|
ERESSEA=$(echo "$PWD" |sed -e 's/\/game.*//')
|
2014-04-27 03:03:14 +02:00
|
|
|
echo "Assuming that ERESSEA=$ERESSEA"
|
|
|
|
fi
|
|
|
|
if [ ! -f reports.txt ]; then
|
|
|
|
echo "need to run $0 from the report direcory"
|
|
|
|
exit -2
|
|
|
|
fi
|
|
|
|
|
|
|
|
PWD=$(pwd)
|
2017-12-03 15:43:22 +01:00
|
|
|
GAME=$(dirname "$PWD")
|
2014-04-27 03:03:14 +02:00
|
|
|
|
|
|
|
TEMPLATE=report-mail.txt
|
|
|
|
if [ "$1" == "-Lde" ]
|
|
|
|
then
|
|
|
|
TEMPLATE=report-mail.de.txt
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" == "-Len" ]
|
|
|
|
then
|
|
|
|
TEMPLATE=report-mail.en.txt
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2017-12-03 15:43:22 +01:00
|
|
|
if [ -e "$GAME/$TEMPLATE" ]; then
|
|
|
|
TEMPLATE="$GAME/$TEMPLATE"
|
2014-04-27 03:03:14 +02:00
|
|
|
else
|
2017-12-03 15:43:22 +01:00
|
|
|
TEMPLATE="$ERESSEA/server/etc/$TEMPLATE"
|
2014-04-27 03:03:14 +02:00
|
|
|
fi
|
|
|
|
|
2017-12-03 15:43:22 +01:00
|
|
|
if [ ! -e "$TEMPLATE" ]; then
|
2014-04-27 03:03:14 +02:00
|
|
|
echo "no such email template: $TEMPLATE"
|
|
|
|
exit -3
|
|
|
|
fi
|
|
|
|
|
|
|
|
while [ -e /tmp/.stopped ] ; do
|
|
|
|
echo "waiting 2 minutes for lockfile in /tmp/.stopped to clear"
|
|
|
|
sleep 120
|
|
|
|
done
|
2015-09-07 11:04:56 +02:00
|
|
|
addr=$1
|
|
|
|
subject=$2
|
|
|
|
shift 2
|
2014-04-27 03:03:14 +02:00
|
|
|
|
2017-12-03 16:42:14 +01:00
|
|
|
mutt -F "$ERESSEA/etc/muttrc" -s "$subject" -a "$@" -- "$addr" \
|
|
|
|
< "$TEMPLATE" || echo "Sending failed for email/report: $2/$3"
|
|
|
|
|