diff --git a/cpdAlerts.sh b/cpdAlerts.sh index 74ec6de..b680c0e 100755 --- a/cpdAlerts.sh +++ b/cpdAlerts.sh @@ -73,13 +73,14 @@ function valencia { do mainURL="https://dogv.gva.es/datos/$(date +"%Y/%m/%d")/pdf/dogv_$(date +"%Y")_$idDogv" mainURL="$(echo $mainURL)_es.pdf" + mainURLStatus=$(wget -NS "$mainURL" 2>&1 | grep "HTTP/" | awk '{print $2}') let idDogv=$idDogv+1 sleep 1 done echo $idDogv > .lastDogv wget -q $mainURL -O $pdfFile - if [ "$(pdftotext $pdfFile - | grep -i -E -n -3 "$keyWords" | tee .cpds | wc -l)" = 0 ]; then echo "0 resultados"; rm -rf .cpds .boletin*; exit; else sendMail $mainURL $comunidad;fi - rm -rf .boletin* + if [ "$(pdftotext $pdfFile - | grep -i -E -n -3 "$keyWords" | tee .cpds | wc -l)" = 0 ]; then echo "0 resultados"; rm -rf .cpds dogv_* .boletin*; exit; else sendMail $mainURL $comunidad;fi + rm -rf dogv_* .boletin* } function help {