From 8667d8d5b125a15561738c132af56465711684be Mon Sep 17 00:00:00 2001 From: "toerd@480" Date: Sun, 16 Aug 2020 23:01:32 +0200 Subject: [PATCH] fix: Prevent mails if there was no conection to primuss --- noten.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/noten.sh b/noten.sh index 96c2aa6..bc32338 100755 --- a/noten.sh +++ b/noten.sh @@ -32,6 +32,11 @@ AJAXDATA=$(curl -s -b $COOKIES -c $COOKIES -d "User=$USERNAME&Session=$SESSION&L # Finally... 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}; //{f=1}' | rg -o -e '(.*)' -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 D=$(diff $FINALFILE $TMPPATH/noten.html) if [ "$D" != "" ]; then