diff options
author | emkael <emkael@tlen.pl> | 2017-06-07 14:38:51 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-06-07 14:38:51 +0200 |
commit | 6cb02962bae8e4bf768ef831b877d154f7a1c87f (patch) | |
tree | 7c10e6817fd898f0357d9da797791e454b19322a /bin | |
parent | 9cce0d58a297b13975f5a61074d514208be9e94c (diff) |
Crontab configuration for fetching Cezar DB
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fetch-cezar-db.sh | 9 |
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 |