From b0db872b46de7de81c95c7253ea9f21a6a7bcfc1 Mon Sep 17 00:00:00 2001 From: Vladislav Klimenko Date: Wed, 29 Nov 2017 16:04:35 +0300 Subject: [PATCH] import window --- run_airline_ontime_import.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/run_airline_ontime_import.sh b/run_airline_ontime_import.sh index b73fb41..8e02161 100755 --- a/run_airline_ontime_import.sh +++ b/run_airline_ontime_import.sh @@ -4,11 +4,17 @@ # looking for csv files in this dir FILES_TO_IMPORT_DIR="/mnt/nas/work/ontime" -# limit import to this number of files +# how many files to skip from the beginning of the list +FILES_TO_SKIP_NUM=0 + +# how many files to import FILES_TO_IMPORT_NUM=3 +# which file would be the first to import +FILE_TO_START_IMPORT_FROM=$((FILES_TO_SKIP_NUM+1)) + i=1 -for file in $(ls "$FILES_TO_IMPORT_DIR"/*.csv|sort|head -n $FILES_TO_IMPORT_NUM); do +for file in $(ls "$FILES_TO_IMPORT_DIR"/*.csv|sort|tail -n +"$FILE_TO_START_IMPORT_FROM"|head -n "$FILES_TO_IMPORT_NUM"); do echo "$i. Prepare. Make link to $file" rm -f ontime ln -s $file ontime @@ -22,6 +28,9 @@ for file in $(ls "$FILES_TO_IMPORT_DIR"/*.csv|sort|head -n $FILES_TO_IMPORT_NUM) -u root \ airline ontime +#--local reads files locally on the client host, bot on the server +#--lock-tables Lock all tables for writing before processing any text files. This ensures that all tables are synchronized on the server. + echo "$i. Cleanup. $file" rm -f ontime