Skip to content

Commit

Permalink
bash script to start indexerclient based on Metafacture
Browse files Browse the repository at this point in the history
  • Loading branch information
guenter hipler committed Sep 25, 2018
1 parent d5b711f commit c67f4f1
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions scripts/sb_post2solr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

cwd=`pwd`

LOGDIR=$cwd/log
LOGFILE=$LOGDIR/post2solr.log


export METAFACTURE_HOME=$cwd



function usage()
{
printf "usage: $0 [-i <content input directory>\n"
}


function preChecks()
{

[ ! -d "$LOGDIR" ] && mkdir -p $LOGDIR && printf "Logdir created ...\n"
[ ! -d "$1" ] && printf "inputdir $1 not available ...\n" && usage && exit 9

printf "prechecks finished ...\n"

}


function runIndexing()
{

echo "given inputdir: $1"

#[ ! -d "$LOGDIR" ] && mkdir -p $LOGDIR && printf "Logdir created ...\n" >> $LOGFILE
[ ! -d "$1" ] && echo "inputdir $1 not available ...\n" && exit 9

printf "start indexing ...\n\n"

./flux.sh fluxscripts/indexsolr.flux \
dir2read=$1

}






#it seems getopts doesn't run in within function scope...
while getopts hi: OPTION
do
case $OPTION in
h) usage
exit 9
;;
i) INPUTDIR=$OPTARG;;

*) printf "unknown option -%c\n" $OPTION; usage; exit;;
esac
done

preChecks $INPUTDIR
runIndexing $INPUTDIR

0 comments on commit c67f4f1

Please sign in to comment.