made hostname and webapp name configurable

git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@388597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
William Au 2006-03-24 18:35:53 +00:00
parent a0c89d8091
commit 6385f459ca
5 changed files with 125 additions and 23 deletions

View File

@ -22,7 +22,7 @@ cd ${0%/*}/..
solr_root=$(pwd)
cd ${orig_dir}
unset solr_port data_dir user verbose
unset solr_hostname solr_port data_dir webapp_name user verbose
. ${solr_root}/bin/scripts-util
# set up variables
@ -31,23 +31,31 @@ log=${solr_root}/logs/${prog}.log
# define usage string
USAGE="\
usage: $prog [-p port] [-d dir] [-u username] [-v]
usage: $prog [-h hostname] [-p port] [-d dir] [-w webappname] [-u username] [-v]
-h specify Solr hostname
-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
-v increase verbosity
"
# parse args
while getopts p:d:u:v OPTION
while getopts h:p:d:w:u:v OPTION
do
case $OPTION in
h)
solr_hostname="$OPTARG"
;;
p)
solr_port="$OPTARG"
;;
d)
data_dir="$OPTARG"
;;
w)
webapp_name="$OPTARG"
;;
u)
user="$OPTARG"
;;
@ -67,7 +75,7 @@ then
exit 1
fi
# user default value for data_dir if not specified
# use default value for data_dir if not specified
# relative path starts at ${solr_root}
if [[ -z ${data_dir} ]]
then
@ -77,6 +85,18 @@ then
data_dir=${solr_root}/${data_dir}
fi
# 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
fixUser "$@"
start=`date +"%s"`
@ -85,7 +105,7 @@ logMessage started by $oldwhoami
logMessage command: $0 $@
logMessage sending commit to Solr server at port ${solr_port}
rs=`curl http://localhost:${solr_port}/solr/update -s -d "<commit/>"`
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<commit/>"`
if [[ $? != 0 ]]
then
logMessage failed to connect to Solr server at port ${solr_port}

View File

@ -22,7 +22,7 @@ cd ${0%/*}/..
solr_root=$(pwd)
cd ${orig_dir}
unset solr_port data_dir user verbose
unset solr_hostname solr_port data_dir webapp_name user verbose
. ${solr_root}/bin/scripts-util
# set up variables
@ -31,23 +31,31 @@ log=${solr_root}/logs/${prog}.log
# define usage string
USAGE="\
usage: $prog [-p port] [-d dir] [-u username] [-v]
usage: $prog [-h hostname] [-p port] [-d dir] [-w webapp_name] [-u username] [-v]
-h specify Solr hostname
-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
-v increase verbosity
"
# parse args
while getopts p:d:u:v OPTION
while getopts h:p:d:w:u:v OPTION
do
case $OPTION in
h)
solr_hostname="$OPTARG"
;;
p)
solr_port="$OPTARG"
;;
d)
data_dir="$OPTARG"
;;
w)
webapp_name="$OPTARG"
;;
u)
user="$OPTARG"
;;
@ -67,7 +75,7 @@ then
exit 1
fi
# user default value for data_dir if not specified
# use default value for data_dir if not specified
# relative path starts at ${solr_root}
if [[ -z ${data_dir} ]]
then
@ -77,6 +85,18 @@ then
data_dir=${solr_root}/${data_dir}
fi
# 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
fixUser "$@"
start=`date +"%s"`
@ -85,7 +105,7 @@ logMessage started by $oldwhoami
logMessage command: $0 $@
logMessage sending optimize to Solr server at port ${solr_port}
rs=`curl http://localhost:${solr_port}/solr/update -s -d "<optimize/>"`
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<optimize/>"`
if [[ $? != 0 ]]
then
logMessage failed to connect to Solr server at port ${solr_port}

View File

@ -22,7 +22,7 @@ cd ${0%/*}/..
solr_root=$(pwd)
cd ${orig_dir}
unset solr_port user verbose
unset solr_hostname solr_port webapp_name user verbose
. ${solr_root}/bin/scripts-util
# set up variables
@ -31,19 +31,27 @@ log=${solr_root}/logs/${prog}.log
# define usage string
USAGE="\
usage: $prog [-p port] [-u username] [-v]
usage: $prog [-h hostname] [-p port] [-w webapp_name] [-u username] [-v]
-h specify Solr hostname
-p specify Solr port number
-w specify name of Solr webapp (defaults to solr)
-u specify user to sudo to before running script
-v increase verbosity
"
# parse args
while getopts p:u:v OPTION
while getopts h:p:w:u:v OPTION
do
case $OPTION in
h)
solr_hostname="$OPTARG"
;;
p)
solr_port="$OPTARG"
;;
w)
webapp_name="$OPTARG"
;;
u)
user="$OPTARG"
;;
@ -60,7 +68,21 @@ if [[ -z ${solr_port} ]]
then
echo "Solr port number missing in $confFile or command line."
echo "$USAGE"
exit 1
exit 1
fi
# 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
fixUser "$@"
@ -70,7 +92,7 @@ start=`date +"%s"`
logMessage started by $oldwhoami
logMessage command: $0 $@
rs=`curl http://localhost:${solr_port}/solr/update -s -d "<commit/>"`
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<commit/>"`
if [[ $? != 0 ]]
then
logMessage failed to connect to Solr server at port ${solr_port}

View File

@ -22,7 +22,7 @@ cd ${0%/*}/..
solr_root=$(pwd)
cd ${orig_dir}
unset solr_port user verbose
unset solr_hostname solr_port webapp_name user verbose
. ${solr_root}/bin/scripts-util
# set up variables
@ -31,20 +31,28 @@ log=${solr_root}/logs/${prog}.log
# define usage string
USAGE="\
usage: $prog [-p port] [-u username] [-v]
usage: $prog [-h hostname] [-p port] [-u username] [-v]
-h specify Solr hostname
-p specify Solr port number
-w specify name of Solr webapp (defaults to solr)
-u specify user to sudo to before running script
-v increase verbosity
"
# parse args
originalargs="$@"
while getopts v OPTION
while getopts h:p:w:u:v OPTION
do
case $OPTION in
h)
solr_hostname="$OPTARG"
;;
p)
solr_port="$OPTARG"
;;
w)
webapp_name="$OPTARG"
;;
u)
user="$OPTARG"
;;
@ -64,6 +72,18 @@ then
exit 1
fi
# 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
fixUser "$@"
start=`date +"%s"`
@ -71,7 +91,7 @@ start=`date +"%s"`
logMessage started by $oldwhoami
logMessage command: $0 $@
rs=`curl http://localhost:${solr_port}/solr/update -s -d "<optimize/>"`
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<optimize/>"`
if [[ $? != 0 ]]
then
logMessage failed to connect to Solr server at port ${solr_port}

View File

@ -22,7 +22,7 @@ cd ${0%/*}/..
solr_root=$(pwd)
cd ${orig_dir}
unset solr_port user verbose
unset solr_hostname solr_port webapp_name user verbose
. ${solr_root}/bin/scripts-util
# set up variables
@ -31,20 +31,28 @@ log=${solr_root}/logs/${prog}.log
# define usage string
USAGE="\
usage: $prog [-p port] [-u username] [-v]
usage: $prog [-p hostname] [-p port] [-w webapp_name] [-u username] [-v]
-h specify Solr hostname
-p specify Solr port number
-w specify name of Solr webapp (defaults to solr)
-u specify user to sudo to before running script
-v increase verbosity
"
# parse args
originalargs="$@"
while getopts p:u:v OPTION
while getopts h:p:w:u:v OPTION
do
case $OPTION in
h)
solr_hostname="$OPTARG"
;;
p)
solr_port="$OPTARG"
;;
w)
webapp_name="$OPTARG"
;;
u)
user="$OPTARG"
;;
@ -64,6 +72,18 @@ then
exit 1
fi
# 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
fixUser "$@"
start=`date +"%s"`
@ -71,7 +91,7 @@ start=`date +"%s"`
logMessage started by $oldwhoami
logMessage command: $0 $@
rs=`curl http://localhost:${solr_port}/solr/update -s -d "<commit/>"`
rs=`curl http://${solr_hostname}:${solr_port}/solr/update -s -d "<commit/>"`
if [[ $? != 0 ]]
then
logMessage failed to connect to Solr server at port ${solr_port}