forked from fonoster/routr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
routr
executable file
·43 lines (36 loc) · 1014 Bytes
/
routr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env sh
set -e
HOME="$(cd "$(dirname "$0")"; pwd)"
RESTART_CODE=123
[ -d "$HOME/jre" ] && JAVA_HOME=$HOME/jre
[ -z "$LOG4J2" ] && LOG4J2=config/log4j2.yml
[ -z "$DATA" ] && DATA=$HOME
run() {
cd $HOME
$JAVA_HOME/bin/java \
-DDATA=$DATA \
-Djava.net.preferIPv4Stack=true \
-Dlog4j.configurationFile=$LOG4J2 \
-Dpolyglot.js.experimental-foreign-object-prototype=true \
-Dpolyglot.js.nashorn-compat=true \
$JAVA_OPTS \
-classpath "$HOME/libs/*" \
io.routr.core.Launcher
return $?
}
if [ -f /.dockerenv ]; then
[ -z "$LOCALNETS" ] && export LOCALNETS=$(netdiscover -field privatev4)/31
[ -z "$BIND_ADDR" ] && export BIND_ADDR=$(netdiscover -field privatev4)
fi
[ -z "$JAVA_HOME" ] && { echo "Could not find a runtime environment. Please setup the JAVA_HOME environment variable"; exit 1; }
{
until false; do
run
exit_code=$?
if [ $exit_code -ne $RESTART_CODE ] ; then
break
fi
done
} || {
echo 'Done'
}