summaryrefslogtreecommitdiff
path: root/bin/fetch-cezar-db.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/fetch-cezar-db.sh')
-rwxr-xr-xbin/fetch-cezar-db.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/fetch-cezar-db.sh b/bin/fetch-cezar-db.sh
index 839e07c..3af7357 100755
--- a/bin/fetch-cezar-db.sh
+++ b/bin/fetch-cezar-db.sh
@@ -2,11 +2,12 @@
PAGEDIR=`dirname $0`
DATE=`date --date='yesterday' +%Y%m%d`
OUTPUTFILE=`realpath $PAGEDIR/../data/cezar/$DATE.csv`
-wget http://msc.com.pl/cezar/download/baza.csv -q -O - | iconv -f windows-1250 -t utf-8 > temp
-if [ -s temp ]; then
- tail -n +2 temp | sort > $OUTPUTFILE
+TMPFILE=$PAGEDIR/temp
+wget http://msc.com.pl/cezar/download/baza.csv -q -O - | iconv -f windows-1250 -t utf-8 > $TMPFILE
+if [ -s $TMPFILE ]; then
+ tail -n +2 $TMPFILE | sort > $OUTPUTFILE
echo "Downloaded Cezar CSV into $OUTPUTFILE"
else
echo 'Cezar CSV fetch failed'
fi
-rm temp
+rm $TMPFILE