Non sto` a descriverlo perche` mi sembra molto semplice.
#!/bin/bash
wget "http://www.sian.it/infoMeteo/stampaBollettinoStampa.do?settore=C&pubblicato=true&outputFormat=2&generatorClass=it.sian.mwablx.web.print.DatiStampaBollettinoDG&chiamata=infoMeteo" --output-document="EmiliaRomagna-Valanghe-$(date +%Y%m%d)-new.pdf"
i=0
while [ -e EmiliaRomagna-Valanghe-$(date +%Y%m%d)-new.pdf ]
do
if [ -e EmiliaRomagna-Valanghe-$(date +%Y%m%d -d "-$i day").pdf ]
then
diff EmiliaRomagna-Valanghe-$(date +%Y%m%d -d "-$i day").pdf EmiliaRomagna-Valanghe-$(date +%Y%m%d)-new.pdf > /dev/null
if [ $? != "0" ]
then
mv EmiliaRomagna-Valanghe-$(date +%Y%m%d)-new.pdf EmiliaRomagna-Valanghe-$(date +%Y%m%d).pdf
echo "mv EmiliaRomagna-Valanghe-$(date +%Y%m%d)-new.pdf EmiliaRomagna-Valanghe-$(date +%Y%m%d).pdf"
else
rm EmiliaRomagna-Valanghe-$(date +%Y%m%d)-new.pdf
echo "REMOVED: EmiliaRomagna-Valanghe-$(date +%Y%m%d)-new.pdf"
fi
else
$(( i++ )) 2> /dev/null
echo $i
fi
done
wget "http://www.sian.it/infoMeteo/stampaBollettinoStampa.do?settore=B&pubblicato=true&outputFormat=2&generatorClass=it.sian.mwablx.web.print.DatiStampaBollettinoDG&chiamata=infoMeteo" --output-document="Toscana-Valanghe-$(date +%Y%m%d)-new.pdf"
i=0
while [ -e Toscana-Valanghe-$(date +%Y%m%d)-new.pdf ]
do
if [ -e Toscana-Valanghe-$(date +%Y%m%d -d "-$i day").pdf ]
then
diff Toscana-Valanghe-$(date +%Y%m%d -d "-$i day").pdf Toscana-Valanghe-$(date +%Y%m%d)-new.pdf > /dev/null
if [ $? != "0" ]
then
mv Toscana-Valanghe-$(date +%Y%m%d)-new.pdf Toscana-Valanghe-$(date +%Y%m%d).pdf
echo "mv Toscana-Valanghe-$(date +%Y%m%d)-new.pdf Toscana-Valanghe-$(date +%Y%m%d).pdf"
else
rm Toscana-Valanghe-$(date +%Y%m%d)-new.pdf
echo "REMOVED: Toscana-Valanghe-$(date +%Y%m%d)-new.pdf"
fi
else
$(( i++ )) 2> /dev/null
echo $i
fi
done
wget http://www.meteotrentino.it/bollettini/today/valanghe_it.pdf --output-document="Trentino-Valanghe-$(date +%Y%m%d)-new.pdf"
i=0
while [ -e Trentino-Valanghe-$(date +%Y%m%d)-new.pdf ]
do
if [ -e Trentino-Valanghe-$(date +%Y%m%d -d "-$i day").pdf ]
then
diff Trentino-Valanghe-$(date +%Y%m%d -d "-$i day").pdf Trentino-Valanghe-$(date +%Y%m%d)-new.pdf > /dev/null
if [ $? != "0" ]
then
mv Trentino-Valanghe-$(date +%Y%m%d)-new.pdf Trentino-Valanghe-$(date +%Y%m%d).pdf
echo "mv Trentino-Valanghe-$(date +%Y%m%d)-new.pdf Trentino-Valanghe-$(date +%Y%m%d).pdf"
else
rm Trentino-Valanghe-$(date +%Y%m%d)-new.pdf
echo "REMOVED: Trentino-Valanghe-$(date +%Y%m%d)-new.pdf"
fi
else
$(( i++ )) 2> /dev/null
echo $i
fi
done
wget http://www.meteotrentino.it/bollettini/today/generale_it.pdf --output-document="Trentino-Meteo-$(date +%Y%m%d)-new.pdf"
i=0
while [ -e Trentino-Meteo-$(date +%Y%m%d)-new.pdf ]
do
if [ -e Trentino-Meteo-$(date +%Y%m%d -d "-$i day").pdf ]
then
diff Trentino-Meteo-$(date +%Y%m%d -d "-$i day").pdf Trentino-Meteo-$(date +%Y%m%d)-new.pdf > /dev/null
if [ $? != "0" ]
then
mv Trentino-Meteo-$(date +%Y%m%d)-new.pdf Trentino-Meteo-$(date +%Y%m%d).pdf
echo "mv Trentino-Meteo-$(date +%Y%m%d)-new.pdf Trentino-Meteo-$(date +%Y%m%d).pdf"
else
rm Trentino-Meteo-$(date +%Y%m%d)-new.pdf
echo "REMOVED: Trentino-Meteo-$(date +%Y%m%d)-new.pdf"
fi
else
$(( i++ )) 2> /dev/null
echo $i
fi
done
wget http://www.arpa.veneto.it/upload_arabba/bollettini_meteo/dolomitimeteo/dolomitimeteo.pdf --output-document="Veneto-Dolomiti-Meteo-$(date +%Y%m%d)-new.pdf"
i=0
while [ -e Veneto-Dolomiti-Meteo-$(date +%Y%m%d)-new.pdf ]
do
if [ -e Veneto-Dolomiti-Meteo-$(date +%Y%m%d -d "-$i day").pdf ]
then
diff Veneto-Dolomiti-Meteo-$(date +%Y%m%d -d "-$i day").pdf Veneto-Dolomiti-Meteo-$(date +%Y%m%d)-new.pdf > /dev/null
if [ $? != "0" ]
then
mv Veneto-Dolomiti-Meteo-$(date +%Y%m%d)-new.pdf Veneto-Dolomiti-Meteo-$(date +%Y%m%d).pdf
echo "mv Veneto-Dolomiti-Meteo-$(date +%Y%m%d)-new.pdf Veneto-Dolomiti-Meteo-$(date +%Y%m%d).pdf"
else
rm Veneto-Dolomiti-Meteo-$(date +%Y%m%d)-new.pdf
echo "REMOVED: Veneto-Dolomiti-Meteo-$(date +%Y%m%d)-new.pdf"
fi
else
$(( i++ )) 2> /dev/null
echo $i
fi
done
wget http://www.arpa.veneto.it/upload_arabba/bollettini_meteo/dolomitineve/dolomitineve.pdf --output-document="Veneto-Dolomiti-Valanghe-$(date +%Y%m%d)-new.pdf"
i=0
while [ -e Veneto-Dolomiti-Valanghe-$(date +%Y%m%d)-new.pdf ]
do
if [ -e Veneto-Dolomiti-Valanghe-$(date +%Y%m%d -d "-$i day").pdf ]
then
diff Veneto-Dolomiti-Valanghe-$(date +%Y%m%d -d "-$i day").pdf Veneto-Dolomiti-Valanghe-$(date +%Y%m%d)-new.pdf > /dev/null
if [ $? != "0" ]
then
mv Veneto-Dolomiti-Valanghe-$(date +%Y%m%d)-new.pdf Veneto-Dolomiti-Valanghe-$(date +%Y%m%d).pdf
echo "mv Veneto-Dolomiti-Valanghe-$(date +%Y%m%d)-new.pdf Veneto-Dolomiti-Valanghe-$(date +%Y%m%d).pdf"
else
rm Veneto-Dolomiti-Valanghe-$(date +%Y%m%d)-new.pdf
echo "REMOVED: Veneto-Dolomiti-Valanghe-$(date +%Y%m%d)-new.pdf"
fi
else
$(( i++ )) 2> /dev/null
echo $i
fi
done
wget -U mozilla http://www.meteoam.it/?q=printpdf/node/10897 --output-document="AM-Rischio-Valanghe-$(date +%Y%m%d)-new.pdf"
i=0
while [ -e AM-Rischio-Valanghe-$(date +%Y%m%d)-new.pdf ]
do
if [ -e AM-Rischio-Valanghe-$(date +%Y%m%d -d "-$i day").pdf ]
then
diff AM-Rischio-Valanghe-$(date +%Y%m%d -d "-$i day").pdf AM-Rischio-Valanghe-$(date +%Y%m%d)-new.pdf > /dev/null
if [ $? != "0" ]
then
mv AM-Rischio-Valanghe-$(date +%Y%m%d)-new.pdf AM-Rischio-Valanghe-$(date +%Y%m%d).pdf
echo "mv AM-Rischio-Valanghe-$(date +%Y%m%d)-new.pdf AM-Rischio-Valanghe-$(date +%Y%m%d).pdf"
else
rm AM-Rischio-Valanghe-$(date +%Y%m%d)-new.pdf
echo "REMOVED: AM-Rischio-Valanghe-$(date +%Y%m%d)-new.pdf"
fi
else
$(( i++ )) 2> /dev/null
echo $i
fi
done
wget -U mozilla http://www.meteoam.it/?q=node/10897 --output-document="AM-Rischio-Valanghe-$(date +%Y%m%d)-new.html"
i=0
while [ -e AM-Rischio-Valanghe-$(date +%Y%m%d)-new.html ]
do
if [ -e AM-Rischio-Valanghe-$(date +%Y%m%d -d "-$i day").html ]
then
diff AM-Rischio-Valanghe-$(date +%Y%m%d -d "-$i day").html AM-Rischio-Valanghe-$(date +%Y%m%d)-new.html > /dev/null
if [ $? != "0" ]
then
mv AM-Rischio-Valanghe-$(date +%Y%m%d)-new.html AM-Rischio-Valanghe-$(date +%Y%m%d).html
echo "mv AM-Rischio-Valanghe-$(date +%Y%m%d)-new.html AM-Rischio-Valanghe-$(date +%Y%m%d).html"
else
rm AM-Rischio-Valanghe-$(date +%Y%m%d)-new.html
echo "REMOVED: AM-Rischio-Valanghe-$(date +%Y%m%d)-new.html"
fi
else
$(( i++ )) 2> /dev/null
echo $i
fi
done
Riferimenti:
http://blog.snowboardactivity.dreamhosters.com/2011/03/13/bollettini-nivometeo/
Nessun commento:
Posta un commento