forked from guardian/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sbt
executable file
·62 lines (47 loc) · 1.69 KB
/
sbt
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
#!/bin/bash
set -o errexit
if [ -f "~/.sbtconfig" ]; then
. ~/.sbtconfig
fi
# Debug option
DEBUG_PARAMS=""
for arg in "$@"
do
if [ "$arg" == "--debug" ]; then
echo "setting java process as debuggable"
DEBUG_PARAMS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044"
shift
fi
done
# gives physical memory in KB
os=$(uname)
if [ "$os" == "Darwin" ]; then
physical_mem=$(sysctl hw.memsize | cut -d' ' -f2 | grep . | awk '{print $1 / 1024}')
else
physical_mem=$(grep MemTotal /proc/meminfo | awk '{print $2}')
fi
#http://stackoverflow.com/questions/5374455/what-does-java-option-xmx-stand-for
jvm_mem="-Xmx$((physical_mem / 2 / 1024))m"
if [ -z $FRONTEND_JVM_ARGS ]; then
FRONTEND_JVM_ARGS="$jvm_mem -XX:ReservedCodeCacheSize=128m -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:NewRatio=4"
fi
echo ''
echo "******************************** USING JVM ARGS ********************************"
echo $FRONTEND_JVM_ARGS
echo "*** to override/customise use export FRONTEND_JVM_ARGS='XXX' in e.g. .bashrc ***"
echo ''
echo ''
echo "********************************* JAVA VERSION *********************************"
java -version
echo "********************************************************************************"
echo ''
export APP_SECRET="this_is_not_a_real_secret_just_for_tests"
####################################################################################
#
# Australia/Sydney -because it is too easy for devs to forget about timezones
#
####################################################################################
java $FRONTEND_JVM_ARGS \
$DEBUG_PARAMS \
-Duser.timezone=Australia/Sydney \
-jar `dirname $0`/bin/sbt-launch.jar "$@"