fix: Prevent mails if there was no conection to primuss

master
toerd@480 4 years ago
parent 861f26ecea
commit 8667d8d5b1

@ -32,6 +32,11 @@ AJAXDATA=$(curl -s -b $COOKIES -c $COOKIES -d "User=$USERNAME&Session=$SESSION&L
# Finally... # Finally...
cp $FINALFILE $TMPPATH cp $FINALFILE $TMPPATH
curl -s -b $COOKIES -c $COOKIES -d $AJAXDATA $FU | awk 'f{ if (/<\/tbody>/){printf "%s", buf; f=0; buf=""} else buf = buf $0 ORS}; /<tbody>/{f=1}' | rg -o -e '<b>(.*)</b>' -r '$1' | sudo -u http tee $FINALFILE curl -s -b $COOKIES -c $COOKIES -d $AJAXDATA $FU | awk 'f{ if (/<\/tbody>/){printf "%s", buf; f=0; buf=""} else buf = buf $0 ORS}; /<tbody>/{f=1}' | rg -o -e '<b>(.*)</b>' -r '$1' | sudo -u http tee $FINALFILE
# If nothing is returned exit to prevent unwanted mails
if [ $(wc -l < $FINALFILE) -lt 2 ]; then
cp $TMPPATH/noten.html $FINALFILE
exit 1
fi
# If there is a change in the file, send an email # If there is a change in the file, send an email
D=$(diff $FINALFILE $TMPPATH/noten.html) D=$(diff $FINALFILE $TMPPATH/noten.html)
if [ "$D" != "" ]; then if [ "$D" != "" ]; then

Loading…
Cancel
Save