From a6ea03945c07331b19ae91c9beba66fe618051a7 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Mon, 18 Mar 2013 14:18:00 -0400 Subject: [PATCH] Added -p switch to batch-import-marc script. --- harvest/batch-import-marc.bat | 11 +++++++++-- harvest/batch-import-marc.sh | 7 +++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/harvest/batch-import-marc.bat b/harvest/batch-import-marc.bat index 35fb02546ba..5a1ff9bc8e8 100644 --- a/harvest/batch-import-marc.bat +++ b/harvest/batch-import-marc.bat @@ -43,6 +43,7 @@ rem Process switches if "%1"=="-d" goto dswitch if "%1"=="-h" goto helpmessage if "%1"=="-m" goto mswitch +if "%1"=="-p" goto pswitch if "%1"=="-z" goto zswitch goto switchloopend :dswitch @@ -53,6 +54,11 @@ goto switchloop set MOVE_DATA=0 shift goto switchloop +:pswitch +set PROPERTIES_FILE=%2 +shift +shift +goto switchloop :zswitch set LOGGING=0 shift @@ -64,7 +70,7 @@ if not "!%1!"=="!!" goto paramsokay :helpmessage echo This script processes a batch of harvested MARC records. echo. -echo Usage: %SCRIPT_NAME% [-dhmz] [harvest subdirectory] +echo Usage: %SCRIPT_NAME% [-dhmz] [-p properties_file] [harvest subdirectory] echo. echo [harvest subdirectory] is a directory name created by the OAI-PMH harvester. echo This script will search the harvest subdirectories of the directories defined @@ -77,6 +83,7 @@ echo -d: Use the directory path as-is, do not append it to %HARVEST_DIR%. echo Useful for non-OAI batch loading. echo -h: Print this message echo -m: Do not move the data files after importing. +echo -p: Used specified SolrMarc configuration properties file echo -z: No logging. goto end :paramsokay @@ -103,10 +110,10 @@ md %BASEPATH%\processed rem Process all the files in the target directory: for %%a in (%BASEPATH%\*.xml %BASEPATH%\*.mrc) do ( - rem Capture solrmarc output to log if "%LOGGING%"=="0" ( call %VUFIND_HOME%\import-marc.bat %%a ) + rem Capture solrmarc output to log if "%LOGGING%"=="1" ( call %VUFIND_HOME%\import-marc.bat %%a 2> %BASEPATH%\log\%%~nxa.log ) diff --git a/harvest/batch-import-marc.sh b/harvest/batch-import-marc.sh index 25c821428df..e026e110ff6 100755 --- a/harvest/batch-import-marc.sh +++ b/harvest/batch-import-marc.sh @@ -22,7 +22,7 @@ function usage { cat <<EOF This script processes a batch of harvested MARC records. -Usage: $(basename $0) [-dhmz] _harvest_subdirectory_ +Usage: $(basename $0) [-dhmz] [-p properties_file] _harvest_subdirectory_ _harvest_subdirectory_ is a directory name created by the OAI-PMH harvester. This script will search the harvest subdirectories of the directories defined @@ -35,17 +35,19 @@ Options: Useful for non-OAI batch loading. -h: Print this message -m: Do not move the data files after importing. +-p: Used specified SolrMarc configuration properties file -z: No logging. EOF } -while getopts ":dhmz" OPT +while getopts ":dhmp:z" OPT do case $OPT in d) BASEPATH_UNDER_HARVEST=false;; h) usage; exit 0;; m) MOVE_DATA=false;; + p) PROPERTIES_FILE="$OPTARG"; export PROPERTIES_FILE;; z) LOGGING=false;; :) echo "argument to '-$OPTARG' is missing" >&2 @@ -113,6 +115,7 @@ do if [ -f $file ] then # Logging output handled by log() function + # PROPERTIES_FILE passed via environment $VUFIND_HOME/import-marc.sh $file 2> >(log $file) if [ $MOVE_DATA == true ] then -- GitLab