-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun-app.sh
More file actions
executable file
·69 lines (56 loc) · 1.86 KB
/
run-app.sh
File metadata and controls
executable file
·69 lines (56 loc) · 1.86 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
#CWD=`echo $(dirname $(readlink -f $0))`
#cd $CWD
test -e server-cred.sh && source server-cred.sh
SITE=${SITE:-}
if [ "$SITE" != "" ]; then
SITE="-"${SITE}
fi
APP=${1}
MAIN=${2}
shift
shift
#ARGS="$@"
ARGS=$@
if [ "$CWD" != "" ]; then
APP_HOME=$CWD
else
APP_HOME=${APP_HOME:-`pwd`}
fi
# fat jar
JAR_FAT=`ls ${APP_HOME}/target/scala-2.13/*assembly*.jar`
# classes
CLASSES=${APP_HOME}/target/scala-2.13/classes
# additional libs
JAR_UNFAT=`ls ${APP_HOME}/lib/*.jar`
# list of jar. Generated with command:
# sbt -error ";project module; export dependencyClasspath" >CLASSPATH
JAR_FILES=`cat CLASSPATH`
CP="${APP_HOME}/conf/:$JAR_FAT:$JAR_UNFAT:$JAR_FILES:$CLASSES"
CONFIG="application${SITE}.conf"
MEM=${MEM:-1G}
STACK=${STACK:-512M}
>&2 echo "=== Class Path ======================================="
echo $CP | sed "s/\:/\n/g" >&2
>&2 echo "======================================================"
>&2 echo "APP: $APP"
>&2 echo "APP_HOME: $APP_HOME"
>&2 echo "MAIN: $MAIN"
# to be compatibble with old scripts (to be deprecated)
>&2 echo "OPT: $OPT"
>&2 echo "JAVA_OPTS: $JAVA_OPTS"
>&2 echo "ARGS: $ARGS"
>&2 echo "SITE: ${SITE}"
>&2 echo "CONFIG: ${CONFIG}"
>&2 echo "MEM: ${MEM}"
>&2 echo "STACK: ${STACK}"
#>&2 echo $CP
>&2 pwd
# command:
# JAVA_OPTS should be overriden by old script parameters like $OPT
# WARNING: Experiment no-globbing !
# WARNING: $ARGS must not be quoted or it will squash multiple arguments from the launch script.
# NOTE: I think the only thing which is extremely stupid in Linux/Unix is SH/BASH
set -o noglob
exec $JAVA_HOME/bin/java -Xss${STACK} -Xms${MEM} -Xmx${MEM} $JAVA_OPTS -Dcolor -Dconfig.resource=$CONFIG -cp $CP $AGENT $OPT $MAIN $ARGS
set +o noglob