forked from mesos/spark-ec2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmesos-daemon
executable file
·33 lines (25 loc) · 1.03 KB
/
mesos-daemon
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
#!/bin/bash
# Set MESOS_PUBLIC_DNS so slaves can be linked in master web UI
export MESOS_PUBLIC_DNS=`wget -q -O - http://instance-data.ec2.internal/latest/meta-data/public-hostname`
# Set PATH to include Scala
export PATH=$PATH:/root/scala-2.9.1.final/bin
# Set HADOOP_HOME variable to allow slaves to get executors from HDFS
export HADOOP_HOME=/root/persistent-hdfs
ulimit -n 8192
PROGRAM=$1
shift
EXTRA_OPTS=""
if [ "$PROGRAM" == "mesos-slave" ]; then
# Compute CPU and memory resources, if not specified.
if [[ "$*" != *--resources* ]]; then
CPUS=`grep processor /proc/cpuinfo | wc -l`
MEM_KB=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
MEM=$[(MEM_KB - 1024 * 1024) / 1024]
EXTRA_OPTS="--resources=cpus:$CPUS;mem:$MEM"
fi
fi
if [ "$PROGRAM" == "mesos-master" ]; then
# Don't keep failed schedulers around waiting for them to reconnect
EXTRA_OPTS+=" --failover-timeout=0"
fi
nohup $PROGRAM --log_dir=/mnt/mesos-logs --work_dir=/mnt/mesos-work "$EXTRA_OPTS" "$@" </dev/null >/mnt/mesos-logs/$PROGRAM.out 2>&1 &