diff --git a/CHANGES.txt b/CHANGES.txt index f2e0df1b21c..e3dc48724fa 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -184,6 +184,11 @@ Bug Fixes 8. SOLR-167: The SynonymFilter sometimes generated incorrect offsets when multi token synonyms were mached in the source text. (yonik) + + 9. SOLR-188: bin scripts do not support non-default webapp names. Added "-U" + option to specify a full path to the update url, overriding the + "-h" (hostname), "-p" (port) and "-w" (webapp name) parameters. + (Jeff Rodenburg via billa) Other Changes 1. Updated to Lucene 2.1 diff --git a/src/scripts/abc b/src/scripts/abc index be811ce8d40..4f47b06d4bf 100755 --- a/src/scripts/abc +++ b/src/scripts/abc @@ -22,8 +22,9 @@ orig_dir=$(pwd) cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} +curl_url="" -unset solr_hostname solr_port data_dir webapp_name user verbose debug +unset solr_hostname solr_port data_dir webapp_name user verbose debug solr_url . ${solr_root}/bin/scripts-util # set up variables @@ -32,18 +33,19 @@ log=${solr_root}/logs/${prog}.log # define usage string USAGE="\ -usage: $prog [-h hostname] [-p port] [-d dir] [-w webappname] [-u username] [-v] - -h specify Solr hostname +usage: $prog [-h hostname] [-p port] [-d dir] [-w webappname] [-u username] [-U url] [-v] [-V] + -h specify Solr hostname (defaults to localhost) -p specify Solr port number - -d specify directory holding index data -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script + -U specify full update url (overrides -h,-p,-w parameters) + -d specify directory holding index data -v increase verbosity -V output debugging info " # parse args -while getopts h:p:d:w:u:vV OPTION +while getopts h:p:d:w:u:U:vV OPTION do case $OPTION in h) @@ -61,6 +63,9 @@ do u) user="$OPTARG" ;; + U) + solr_url="$OPTARG" + ;; v) verbose="v" ;; @@ -75,13 +80,6 @@ done [[ -n $debug ]] && set -x -if [[ -z ${solr_port} ]] -then - echo "Solr port number missing in $confFile or command line." - echo "$USAGE" - exit 1 -fi - # use default value for data_dir if not specified # relative path starts at ${solr_root} if [[ -z ${data_dir} ]] @@ -92,16 +90,29 @@ then data_dir=${solr_root}/${data_dir} fi -# use default hostname if not specified -if [[ -z ${solr_hostname} ]] +if [[ -n ${solr_url} ]] then - solr_hostname=localhost -fi + curl_url=${solr_url} +else + if [[ -z ${solr_port} ]] + then + echo "Solr port number missing in $confFile or command line." + echo "$USAGE" + exit 1 + fi -# use default webapp name if not specified -if [[ -z ${webapp_name} ]] -then + # use default hostname if not specified + if [[ -z ${solr_hostname} ]] + then + solr_hostname=localhost + fi + + # use default webapp name if not specified + if [[ -z ${webapp_name} ]] + then webapp_name=solr + fi + curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update fi fixUser "$@" @@ -111,11 +122,11 @@ start=`date +"%s"` logMessage started by $oldwhoami logMessage command: $0 $@ -logMessage sending commit to Solr server at port ${solr_port} -rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d ""` +logMessage sending commit to Solr server at ${curl_url} +rs=`curl ${curl_url} -s -d ""` if [[ $? != 0 ]] then - logMessage failed to connect to Solr server at port ${solr_port} + logMessage failed to connect to Solr server at ${curl_url} logMessage commit failed logExit failed 1 fi @@ -124,7 +135,7 @@ fi echo $rs | grep ' /dev/null 2>&1 if [[ $? != 0 ]] then - logMessage commit request to Solr at port ${solr_port} failed: + logMessage commit request to Solr at ${curl_url} failed: logMessage $rs logExit failed 2 fi @@ -134,7 +145,7 @@ lastsnap=`ls -drt1 ${data_dir}/snapshot.* 2> /dev/null | tail -1 ` if [[ $lastsnap == "" ]] then - logMessage commit did not create snapshot at port ${solr_port}, backup failed: + logMessage commit did not create snapshot at ${curl_url}, backup failed: logExit failed 3 fi diff --git a/src/scripts/abo b/src/scripts/abo index 1e02658b3a6..2906456f172 100755 --- a/src/scripts/abo +++ b/src/scripts/abo @@ -22,8 +22,9 @@ orig_dir=$(pwd) cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} +curl_url="" -unset solr_hostname solr_port data_dir webapp_name user verbose debug +unset solr_hostname solr_port data_dir webapp_name user verbose debug solr_url . ${solr_root}/bin/scripts-util # set up variables @@ -32,18 +33,19 @@ log=${solr_root}/logs/${prog}.log # define usage string USAGE="\ -usage: $prog [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-v] - -h specify Solr hostname +usage: $prog [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-U url] [-v] [-V] + -h specify Solr hostname (defaults to localhost) -p specify Solr port number - -d specify directory holding index data -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script + -U specify full update url (overrides -h,-p,-w parameters) + -d specify directory holding index data (defaults to data) -v increase verbosity -V output debugging info " # parse args -while getopts h:p:d:w:u:vV OPTION +while getopts h:p:d:w:u:U:vV OPTION do case $OPTION in h) @@ -61,6 +63,9 @@ do u) user="$OPTARG" ;; + U) + solr_url="$OPTARG" + ;; v) verbose="v" ;; @@ -75,13 +80,6 @@ done [[ -n $debug ]] && set -x -if [[ -z ${solr_port} ]] -then - echo "Solr port number missing in $confFile or command line." - echo "$USAGE" - exit 1 -fi - # use default value for data_dir if not specified # relative path starts at ${solr_root} if [[ -z ${data_dir} ]] @@ -92,16 +90,29 @@ then data_dir=${solr_root}/${data_dir} fi -# use default hostname if not specified -if [[ -z ${solr_hostname} ]] +if [[ -n ${solr_url} ]] then - solr_hostname=localhost -fi + curl_url=${solr_url} +else + if [[ -z ${solr_port} ]] + then + echo "Solr port number missing in $confFile or command line." + echo "$USAGE" + exit 1 + fi -# use default webapp name if not specified -if [[ -z ${webapp_name} ]] -then + # use default hostname if not specified + if [[ -z ${solr_hostname} ]] + then + solr_hostname=localhost + fi + + # use default webapp name if not specified + if [[ -z ${webapp_name} ]] + then webapp_name=solr + fi + curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update fi fixUser "$@" @@ -111,11 +122,11 @@ start=`date +"%s"` logMessage started by $oldwhoami logMessage command: $0 $@ -logMessage sending optimize to Solr server at port ${solr_port} -rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d ""` +logMessage sending optimize to Solr server at ${curl_url} +rs=`curl ${curl_url} -s -d ""` if [[ $? != 0 ]] then - logMessage failed to connect to Solr server at port ${solr_port} + logMessage failed to connect to Solr server at ${curl_url} logMessage optimize failed logExit failed 1 fi @@ -124,7 +135,7 @@ fi echo $rs | grep ' /dev/null 2>&1 if [[ $? != 0 ]] then - logMessage optimize request to Solr at port ${solr_port} failed: + logMessage optimize request to Solr at ${curl_url} failed: logMessage $rs logExit failed 2 fi @@ -134,7 +145,7 @@ lastsnap=`ls -drt1 ${data_dir}/snapshot.* | tail -1 ` if [[ $lastsnap == "" ]] then - logMessage commit did not create snapshot at port ${solr_port}, backup failed: + logMessage commit did not create snapshot at ${curl_url}, backup failed: logExit failed 3 fi diff --git a/src/scripts/commit b/src/scripts/commit index 3c3391b5576..7355f7ed522 100755 --- a/src/scripts/commit +++ b/src/scripts/commit @@ -22,8 +22,9 @@ orig_dir=$(pwd) cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} +curl_url="" -unset solr_hostname solr_port webapp_name user verbose debug +unset solr_hostname solr_port webapp_name user verbose debug solr_url . ${solr_root}/bin/scripts-util # set up variables @@ -32,17 +33,18 @@ log=${solr_root}/logs/${prog}.log # define usage string USAGE="\ -usage: $prog [-h hostname] [-p port] [-w webapp_name] [-u username] [-v] - -h specify Solr hostname +usage: $prog [-h hostname] [-p port] [-w webapp_name] [-u username] [-U url] [-v] [-V] + -h specify Solr hostname (defaults to localhost) -p specify Solr port number -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script + -U specify full update url (overrides -h,-p,-w parameters) -v increase verbosity -V output debugging info " # parse args -while getopts h:p:w:u:vV OPTION +while getopts h:p:w:u:U:vV OPTION do case $OPTION in h) @@ -57,6 +59,9 @@ do u) user="$OPTARG" ;; + U) + solr_url="$OPTARG" + ;; v) verbose="v" ;; @@ -71,25 +76,29 @@ done [[ -n $debug ]] && set -x -if [[ -z ${solr_port} ]] +if [[ -n ${solr_url} ]] then + curl_url=${solr_url} +else + if [[ -z ${solr_port} ]] + then echo "Solr port number missing in $confFile or command line." echo "$USAGE" + exit 1 + fi - - exit 1 -fi - -# use default hostname if not specified -if [[ -z ${solr_hostname} ]] -then + # use default hostname if not specified + if [[ -z ${solr_hostname} ]] + then solr_hostname=localhost -fi + fi -# use default webapp name if not specified -if [[ -z ${webapp_name} ]] -then + # use default webapp name if not specified + if [[ -z ${webapp_name} ]] + then webapp_name=solr + fi + curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update fi fixUser "$@" @@ -99,10 +108,10 @@ start=`date +"%s"` logMessage started by $oldwhoami logMessage command: $0 $@ -rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d ""` +rs=`curl ${curl_url} -s -d ""` if [[ $? != 0 ]] then - logMessage failed to connect to Solr server at port ${solr_port} + logMessage failed to connect to Solr server at ${curl_url} logMessage commit failed logExit failed 1 fi @@ -111,7 +120,7 @@ fi echo $rs | grep ' /dev/null 2>&1 if [[ $? != 0 ]] then - logMessage commit request to Solr at port ${solr_port} failed: + logMessage commit request to Solr at ${curl_url} failed: logMessage $rs logExit failed 2 fi diff --git a/src/scripts/optimize b/src/scripts/optimize index 3a67dd93822..3cb451d8edd 100755 --- a/src/scripts/optimize +++ b/src/scripts/optimize @@ -22,8 +22,9 @@ orig_dir=$(pwd) cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} +curl_url="" -unset solr_hostname solr_port webapp_name user verbose debug +unset solr_hostname solr_port webapp_name user verbose debug solr_url . ${solr_root}/bin/scripts-util # set up variables @@ -32,18 +33,19 @@ log=${solr_root}/logs/${prog}.log # define usage string USAGE="\ -usage: $prog [-h hostname] [-p port] [-u username] [-v] - -h specify Solr hostname +usage: $prog [-h hostname] [-p port] [-u username] [-U url] [-v] [-V] + -h specify Solr hostname (defaults to localhost) -p specify Solr port number -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script + -U specify full update url (overrides -h,-p,-w parameters) -v increase verbosity -V output debugging info " # parse args originalargs="$@" -while getopts h:p:w:u:vV OPTION +while getopts h:p:w:u:U:vV OPTION do case $OPTION in h) @@ -58,6 +60,9 @@ do u) user="$OPTARG" ;; + U) + solr_url="$OPTARG" + ;; v) verbose="v" ;; @@ -72,23 +77,29 @@ done [[ -n $debug ]] && set -x -if [[ -z ${solr_port} ]] +if [[ -n ${solr_url} ]] then + curl_url=${solr_url} +else + if [[ -z ${solr_port} ]] + then echo "Solr port number missing in $confFile or command line." echo "$USAGE" exit 1 -fi + fi -# use default hostname if not specified -if [[ -z ${solr_hostname} ]] -then + # use default hostname if not specified + if [[ -z ${solr_hostname} ]] + then solr_hostname=localhost -fi + fi -# use default webapp name if not specified -if [[ -z ${webapp_name} ]] -then + # use default webapp name if not specified + if [[ -z ${webapp_name} ]] + then webapp_name=solr + fi + curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update fi fixUser "$@" @@ -98,19 +109,19 @@ start=`date +"%s"` logMessage started by $oldwhoami logMessage command: $0 $@ -rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d ""` +rs=`curl ${curl_url} -s -d ""` if [[ $? != 0 ]] then - logMessage failed to connect to Solr server at port ${solr_port} + logMessage failed to connect to Solr server at ${curl_url} logMessage optimize failed logExit failed 1 fi # check status of optimize request -echo $rs | grep ' /dev/null 2>&1 +rc=`echo $rs|cut -f2 -d'"'` if [[ $? != 0 ]] then - logMessage optimize request to Solr at port ${solr_port} failed: + logMessage optimize request to Solr at ${curl_url} failed: logMessage $rs logExit failed 2 fi diff --git a/src/scripts/readercycle b/src/scripts/readercycle index fdb8c152b61..b7a4d7c62c1 100755 --- a/src/scripts/readercycle +++ b/src/scripts/readercycle @@ -22,8 +22,9 @@ orig_dir=$(pwd) cd ${0%/*}/.. solr_root=$(pwd) cd ${orig_dir} +curl_url="" -unset solr_hostname solr_port webapp_name user verbose debug +unset solr_hostname solr_port webapp_name user verbose debug solr_url . ${solr_root}/bin/scripts-util # set up variables @@ -32,18 +33,19 @@ log=${solr_root}/logs/${prog}.log # define usage string USAGE="\ -usage: $prog [-p hostname] [-p port] [-w webapp_name] [-u username] [-v] - -h specify Solr hostname +usage: $prog [-p hostname] [-p port] [-w webapp_name] [-u username] [-U url] [-v] [-V] + -h specify Solr hostname (defaults to localhost) -p specify Solr port number -w specify name of Solr webapp (defaults to solr) -u specify user to sudo to before running script + -U specify full update url (overrides -h,-p,-w parameters) -v increase verbosity -V output debugging info " # parse args originalargs="$@" -while getopts h:p:w:u:vV OPTION +while getopts h:p:w:u:U:vV OPTION do case $OPTION in h) @@ -58,6 +60,9 @@ do u) user="$OPTARG" ;; + U) + solr_url="$OPTARG" + ;; v) verbose="v" ;; @@ -72,23 +77,29 @@ done [[ -n $debug ]] && set -x -if [[ -z ${solr_port} ]] +if [[ -n ${solr_url} ]] then + curl_url=${solr_url} +else + if [[ -z ${solr_port} ]] + then echo "Solr port number missing in $confFile or command line." echo "$USAGE" exit 1 -fi + fi -# use default hostname if not specified -if [[ -z ${solr_hostname} ]] -then + # use default hostname if not specified + if [[ -z ${solr_hostname} ]] + then solr_hostname=localhost -fi + fi -# use default webapp name if not specified -if [[ -z ${webapp_name} ]] -then + # use default webapp name if not specified + if [[ -z ${webapp_name} ]] + then webapp_name=solr + fi + curl_url=http://${solr_hostname}:${solr_port}/${webapp_name}/update fi fixUser "$@" @@ -98,10 +109,10 @@ start=`date +"%s"` logMessage started by $oldwhoami logMessage command: $0 $@ -rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d ""` +rs=`curl ${curl_url} -s -d ""` if [[ $? != 0 ]] then - logMessage failed to connect to Solr server at port ${solr_port} + logMessage failed to connect to Solr server at ${curl_url} logMessage reader cycle failed logExit failed 1 fi @@ -110,7 +121,7 @@ fi echo $rs | grep ' /dev/null 2>&1 if [[ $? != 0 ]] then - logMessage reader cycle request to Solr at port ${solr_port} failed: + logMessage reader cycle request to Solr at ${curl_url} failed: logMessage $rs logExit failed 2 fi