description "chronos" # Start just after the System-V jobs (rc) to ensure networking and zookeeper # are started. This is as simple as possible to ensure compatibility with # Ubuntu, Debian, CentOS, and RHEL distros. See: # http://upstart.ubuntu.com/cookbook/#standard-idioms start on stopped rc RUNLEVEL=[2345] respawn script export JAVA_LIBRARY_PATH="/usr/local/lib:/lib:/usr/lib" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-/lib}" export LD_LIBRARY_PATH="$JAVA_LIBRARY_PATH:$LD_LIBRARY_PATH" CHRONOS_HOME=/usr/local/lib/chronos HEAP=384m #If we're on Amazon, let's use the public hostname so redirect works as expected. if public_hostname="$( curl -sSf --connect-timeout 1 http://169.254.169.254/latest/meta-data/public-hostname )" then HOSTNAME=$public_hostname else HOSTNAME=`hostname -f` fi #If /etc/mesos/zk exists, use it to configure zookeeper if [ -f /etc/mesos/zk ] then MASTER=`cat /etc/mesos/zk` ZK_HOSTS=`echo $MASTER | sed 's/zk:\/\///g;s/\/.*//'` fi # Override defaults with user-specificed defaults [ ! -f /etc/default/chronos ] || . /etc/default/chronos CHRONOS_JAR=${CHRONOS_JAR:-`echo $CHRONOS_HOME/chronos*.jar`} VM_OPTS=${VM_OPTS:--Xmx"$HEAP" -Xms"$HEAP"} # Redirect stdout to syslog mkfifo /tmp/chronos-log-stdout-fifo ( logger -p user.info -t chronos /tmp/chronos-log-stdout-fifo rm /tmp/chronos-log-stdout-fifo # Redirect stderr to syslog mkfifo /tmp/chronos-log-stderr-fifo ( logger -p user.err -t chronos /tmp/chronos-log-stderr-fifo rm /tmp/chronos-log-stderr-fifo exec java \ ${VM_OPTS:+$VM_OPTS} \ ${LIB_PATH:+-Djava.library.path=$LIB_PATH} \ ${CHRONOS_JAR:+-cp $CHRONOS_JAR org.apache.mesos.chronos.scheduler.Main} \ ${ZK_HOSTS:+--zk_hosts "$ZK_HOSTS"} \ ${MASTER:+--master $MASTER} \ ${HOSTNAME:+--hostname $HOSTNAME} \ ${HTTP_PORT:+--http_port $HTTP_PORT} \ ${HTTPS_PORT:+--https_port $HTTPS_PORT} \ ${OPTS:+$OPTS} end script