brouter/misc/scripts/standalone/server.sh
Henrik Fehlauer 3118dd4e76 Allow to run server.sh from source directory
Running server.sh after cloning and building did not work without
also customizing paths and/or moving files around.

By referring to already existing default locations the out-of-the-box
experience should be a bit smoother.

In order to not affect existing installations and to retain support for
running released versions from http://brouter.de/brouter/revisions.html,
the old default paths are still checked.
2019-05-30 23:52:59 +02:00

31 lines
1.2 KiB
Bash
Executable file

#!/bin/sh
cd "$(dirname "$0")"
# BRouter standalone server
# java -cp brouter.jar btools.brouter.RouteServer <segmentdir> <profile-map> <customprofiledir> <port> <maxthreads> [bindaddress]
# maxRunningTime is the request timeout in seconds, set to 0 to disable timeout
JAVA_OPTS="-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300"
# If paths are unset, first search in locations matching the directory structure
# as found in the official BRouter zip archive
CLASSPATH=${CLASSPATH:-"../brouter.jar"}
SEGMENTSPATH=${SEGMENTSPATH:-"../segments4"}
PROFILESPATH=${PROFILESPATH:-"../profiles2"}
CUSTOMPROFILESPATH=${CUSTOMPROFILESPATH:-"../customprofiles"}
# Otherwise try to locate files inside the source checkout
if [ ! -e "$CLASSPATH" ]; then
CLASSPATH="$(ls ../../../brouter-server/target/brouter-server-*jar-with-dependencies.jar | sort --reverse --version-sort | head --lines 1)"
fi
if [ ! -e "$SEGMENTSPATH" ]; then
SEGMENTSPATH="../../segments4"
fi
if [ ! -e "$PROFILESPATH" ]; then
PROFILESPATH="../../profiles2"
fi
if [ ! -e "$CUSTOMPROFILESPATH" ]; then
CUSTOMPROFILESPATH="../../customprofiles"
fi
java $JAVA_OPTS -cp $CLASSPATH btools.server.RouteServer "$SEGMENTSPATH" "$PROFILESPATH" "$CUSTOMPROFILESPATH" 17777 1 $BINDADDRESS