Files
sailing-analytics/java/target/start
T

50 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# source variables
. `pwd`/env.sh
# make some checks
JAVA_BINARY=$JAVA_HOME/bin/java
if [[ ! -d "$JAVA_HOME" ]]; then
echo "Could not find $JAVA_BINARY set in env.sh. Trying to find the correct one..."
JAVA_VERSION=$(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
if [ "$JAVA_VERSION" -lt 17 ]; then
echo "The current Java version ($JAVA_VERSION) does not match the requirements (>= 1.7)."
exit
fi
JAVA_BINARY=`which java`
echo "Using Java from $JAVA_BINARY"
fi
TELNET_ACTIVE=`netstat -tlnp 2>/dev/null | grep ":$SERVER_PORT"`
if [[ $TELNET_ACTIVE != "" ]]; then
echo "There is something already running on port $SERVER_PORT. Perhaps your server that has not been stopped?"
exit
fi
scriptdir=`dirname "$0"`
LIB_DIR=`pwd`/native-libraries
echo "Script directory is $scriptdir and LIB_DIR is $LIB_DIR"
nohup $JAVA_BINARY -XX:+UseMembar -D$SERVER_NAME -Dcom.sap.sailing.server.name=$SERVER_NAME -Djava.io.tmpdir=`pwd`/tmp -Dfile.encoding=cp1252 -Djetty.home=$scriptdir/configuration/jetty -Djava.util.logging.config.file=$scriptdir/configuration/logging.properties -Djava.library.path=$LIB_DIR -Xmx$MEMORY -jar plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -console $TELNET_PORT -configuration ./ -clean 2>/dev/null >/dev/null &
echo "Starting server..."
sleep 2
TELNET_ACTIVE=`netstat -tlnp 2>/dev/null | grep ":$TELNET_PORT"`
if [[ $TELNET_PORT == "" ]] || [[ $TELNET_ACTIVE == "" ]]; then
echo "Something went wrong with startup. Please check the logs..."
exit
fi
echo "Configuration for this server is:"
echo "SERVER_NAME: $SERVER_NAME"
echo "SERVER_PORT: $SERVER_PORT"
echo "MEMORY: $MEMORY"
echo "TELNET_PORT: $TELNET_PORT"
echo "MONGODB_PORT: $MONGODB_PORT"
echo "EXPEDITION_PORT: $EXPEDITION_PORT"
echo "REPLICATION_CHANNEL: $REPLICATION_CHANNEL"
echo "Started $SERVER_NAME - use telnet localhost $TELNET_PORT to connect to the OSGi console. Logs should be found in logs/sailing0.log.0"