forked from mesos/chronos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
30 lines (21 loc) · 868 Bytes
/
run
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
#!/bin/bash
set -o errexit -o nounset -o pipefail
#TODO(FL): This won't work if there are multiple jar files.
app_jar=/srv/chronos/chronos.jar
main=com.airbnb.scheduler.Main
heap=2048m
environment_directory=/srv/chronos/environment
public_hostname=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
ip=$(ifconfig | grep inet | grep -v inet6 | grep -v '127.0.0.1' | awk -F: '{ print $2 }' | awk '{ print $1 }')
# Setup the libprocess ip
echo "$ip" > "$environment_directory"/LIBPROCESS_IP
jvm_options=( -cp "$app_jar" -server -Xmx"$heap" -Xms"$heap"
-XX:+PrintClassHistogram
)
app_options=( --hostname $public_hostname )
function start {
echo "$(date): $(env)"
echo "$(date) [ulimit] $(ulimit -n)"
exec chpst -u www-data -e $environment_directory java "${jvm_options[@]}" "$main" "${app_options[@]}" 2>&1
}
start