Files
secondo/Optimizer/StartOptServer
2026-01-23 17:03:45 +08:00

156 lines
3.0 KiB
Plaintext

# !/bin/bash
#This file is part of SECONDO.
#Copyright (C) 2004, University in Hagen, Department of Computer Science,
#Database Systems for New Applications.
#SECONDO is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#SECONDO is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with SECONDO; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# variables of the client part
AUTOQUIT=""
TRACE=""
HOST=""
PORT=""
CONFIG=""
PSWD=""
USER=""
while getopts "h:p:u:s:c:q" Option
do
case $Option in
h ) HOST=$OPTARG ;;
p ) PORT=$OPTARG ;;
c ) CONFIG=$OPTARG ;;
s ) PSWD=$OPTARG ;;
u ) USER=$OPTARG ;;
q ) AUTOQUIT="-autoquit" ;;
t ) TRACE="-trace_commands" ;;
* )
esac
done
shift $(($OPTIND - 1))
# port of the server part
if [ -z $BASH_ARGV ]; then
S_PORT=1235
else
# check for integer
x=$1
if [ "${x/[0-9]*/x}" == "x" ]; then
S_PORT=$x
shift
else
S_PORT=1235
fi
fi
if [ "$SECONDO_PLATFORM" != win32 ]; then
echo"" # unset SWI_HOME_DIR
fi
if [ "$SECONDO_JAVA" != "" ]; then
JAVA=$SECONDO_JAVA
CLASSPATH=$SECONDO_JAVART
else
JAVA=java
fi
CLASSPATH=.
if [ "$JPL_JAR" != "" ]; then
CLASSPATH=$CLASSPATH:$JPL_JAR;
else
CLASSPATH=../Jpl/lib/classes:$CLASSPATH
fi
LIB_PATH=.
if [ "$JPL_DLL" != "" ]; then
if [ -n "$PL_DLL_DIR" ]; then
LIB_PATH=$PL_DLL_DIR:$LIB_PATH
elif [ -n "$PL_LIB_DIR" ]; then
LIB_PATH=$PL_LIB_DIR:$LIB_PATH
fi
LIB_PATH=$(dirname $LIB_PATH:$JPL_DLL)
fi
OLD_HOST=$SECONDO_HOST
OLD_PORT=$SECONDO_PORT
OLD_CONFIG=$SECONDO_CONFIG
OLD_USER=$SECONDO_USER
OLD_PSWD=$SECONDO_PSWD
if [ -n "$CONFIG" ]; then
export SECONDO_CONFIG=$CONFIG
fi
if [ -n "$HOST" ]; then
export SECONDO_HOST=$HOST
fi
if [ -n "$PORT" ]; then
export SECONDO_PORT=$PORT
fi
if [ -n "$USER" ]; then
export SECONDO_USER=$USER
fi
if [ -n "$PSWD" ]; then
export SECONDO_PSWD=$PSWD
fi
JAVAPATH=$(find -L $J2SDK_ROOT -iname libjsig.so | head -n 1 | sed "s/libjsig.so//")
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH=$JAVAPATH
else
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JAVAPATH
fi
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
cmd="$JAVA -Djava.library.path=$LIB_PATH -classpath $CLASSPATH OptimizerServer $S_PORT $AUTOQUIT $TRACE $*"
echo $cmd
if [ -n "$FILE" ]; then
$cmd <$FILE
else
$cmd
fi
if [ -n "$CONFIG" ]; then
export SECONDO_CONFIG=$OLD_CONFIG
fi
if [ -n "$HOST" ]; then
export SECONDO_HOST=$OLD_HOST
fi
if [ -n "$PORT" ]; then
export SECONDO_PORT=$OLD_PORT
fi
if [ -n "$USER" ]; then
export SECONDO_USER=$OLD_USER
fi
if [ -n "$PSWD" ]; then
export SECONDO_PSWD=$OLD_PSWD
fi