diff options
author | emkael <emkael@tlen.pl> | 2017-09-08 01:28:21 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-09-08 01:28:21 +0200 |
commit | 8f795b1d445441daab5ffb75060a6dbf8ed0934a (patch) | |
tree | 15e55a2a7e03867ac0cccfb8303674d478510503 /bin/cezar-db-fetch.sh | |
parent | 655a9847513332e8e119f37f7ed95f4ab002b1a1 (diff) |
Renaming scripts so that their names make sense
Diffstat (limited to 'bin/cezar-db-fetch.sh')
-rwxr-xr-x | bin/cezar-db-fetch.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/cezar-db-fetch.sh b/bin/cezar-db-fetch.sh new file mode 100755 index 0000000..3af7357 --- /dev/null +++ b/bin/cezar-db-fetch.sh @@ -0,0 +1,13 @@ +#!/bin/bash +PAGEDIR=`dirname $0` +DATE=`date --date='yesterday' +%Y%m%d` +OUTPUTFILE=`realpath $PAGEDIR/../data/cezar/$DATE.csv` +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 $TMPFILE |