formula-consul/consul/files/consul.upstart
Bahadır Kandemir 3676273bc4 Initial commit
2015-10-07 21:18:22 +03:00

26 lines
585 B
Plaintext

description "Consul agent"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
script
if [ -f "/etc/service/consul" ]; then
. /etc/service/consul
fi
# Make sure to use all our CPUs, because Consul can block a scheduler thread
export GOMAXPROCS=`nproc`
# Get the public IP
BIND=`ifconfig eth0 | grep "inet addr" | awk '{ print substr($2,6) }'`
exec start-stop-daemon --start -c consul \
--exec /usr/local/bin/consul agent -- \
-config-dir="/etc/consul.d" \
-bind=$BIND \
${CONSUL_FLAGS} \
>> /var/log/consul.log 2>&1
end script