Student imports sftp client force-new option
authorBill Erickson <berickxx@gmail.com>
Mon, 17 Sep 2018 19:59:57 +0000 (12:59 -0700)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Adds a new -n flag to sftp-client-agent.sh so the agent can be used to
process files with >500 new accounts instead of having to process
manually with generate-patrons-from-csv.pl

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/utility-scripts/import_students/sftp-client-agent.sh

index a5a39bf..c9017c5 100755 (executable)
@@ -9,6 +9,7 @@ set -euo pipefail
 # -------------------------------------------------------------------------
 
 SUCCESS=0
+FORCE_NEW="";
 SERVER=prod-depot.eg.kcls.org;
 USER=sftpagent;
 LIST_PENDING="";
@@ -92,6 +93,8 @@ function usage {
 
             -f Fetch pending files
 
+            -n Force load using --force-new
+
             -b Database server
 
             -a Archive files
@@ -134,7 +137,7 @@ function on_exit {
 
 trap on_exit EXIT;
 
-while getopts "s:u:d:b:plfah" opt; do
+while getopts "s:u:d:b:plfanh" opt; do
     case $opt in
         s) SERVER="$OPTARG";;
         u) USER="$OPTARG";;
@@ -144,6 +147,7 @@ while getopts "s:u:d:b:plfah" opt; do
         f) FETCH_PENDING="YES";;
         a) ARCHIVE="YES";;
         d) DISTRICT_CODE="$OPTARG";;
+        n) FORCE_NEW="--force-new";;
         h) usage;
     esac
 done;
@@ -209,7 +213,7 @@ for code in "${CODES_TO_PROCESS[@]}"; do
 
             announce "Processing file $LOCAL_FILE"
             INFO=$(perl ./generate-patrons-from-csv.pl \
-                --log-stdout $TEACHER_FLAG $COLLEGE_FLAG \
+                --log-stdout $TEACHER_FLAG $COLLEGE_FLAG $FORCE_NEW \
                 --db-host $DB_HOST \
                 --district-code $code \
                 --commit-mode each \