2024-02-14 14:48:34 +00:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
logfile=$(mktemp)
|
|
|
|
exec &>> $logfile
|
|
|
|
exec 100> $HOME/homepage.lock
|
|
|
|
|
|
|
|
#pwd
|
|
|
|
#whoami
|
|
|
|
|
|
|
|
file=$(mktemp)
|
|
|
|
cat > $file
|
|
|
|
|
|
|
|
finish() {
|
|
|
|
code=$?
|
|
|
|
|
|
|
|
cat $logfile >> /tmp/mailpipe.log
|
|
|
|
|
|
|
|
if [ $code -gt 0 ]
|
|
|
|
then
|
2024-06-25 13:54:57 +00:00
|
|
|
sendmail homepage@tanzsportclub.vfl-sindelfingen.de << EOF
|
2024-02-14 14:48:34 +00:00
|
|
|
From: TSC Homepage Bot <tsc-homepage@server-hh>
|
2024-06-25 13:54:57 +00:00
|
|
|
To: Homepage Team <homepage@tanzsportclub.vfl-sindelfingen.de>
|
2024-06-25 13:54:32 +00:00
|
|
|
Date: $(date --rfc-email)
|
2024-02-14 14:48:34 +00:00
|
|
|
Subject: Failed to parse ESV mail
|
|
|
|
|
2024-06-25 13:54:57 +00:00
|
|
|
Beim Parsen einer eingehenden Mail mit Informationen zu einer Turnieranmelung gab es einen Fehler.
|
|
|
|
Bitte die Anmeldung manuell in der Homepage nachtragen und ggf den Parser korrigieren.
|
|
|
|
|
|
|
|
Weitere Informationen siehe unten:
|
|
|
|
|
2024-02-14 14:48:34 +00:00
|
|
|
The parsing of the competition notification failed. Please see also the logs!
|
|
|
|
|
|
|
|
The output of the script:
|
|
|
|
|
|
|
|
$(cat $logfile)
|
|
|
|
|
|
|
|
The offending mail was this one:
|
|
|
|
|
|
|
|
$(cat $file)
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
exit $?
|
|
|
|
}
|
|
|
|
trap finish EXIT
|
|
|
|
|
|
|
|
flock 100
|
|
|
|
|
|
|
|
cd $HOME/hugo-page
|
|
|
|
git fetch
|
|
|
|
git reset --hard origin/develop
|
|
|
|
|
|
|
|
. ~/venv-homepage/bin/activate
|
|
|
|
pip install -r scripts/read-competition-notification/requirements.txt
|
|
|
|
|
|
|
|
./scripts/read-competition-notification/run.sh -o content/turniermeldung --read-mbox $file -vv
|
|
|
|
|
|
|
|
git add content/turniermeldung
|
|
|
|
git commit -m "Automatic commit to create new competition notification"
|
|
|
|
git push origin develop
|
|
|
|
|
|
|
|
rm $file
|