formula-consul/consul/files/consul.upstart

25 lines
613 B
Text

description "Consul agent"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
script
if [ -f /etc/default/consul ]; then
. /etc/default/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 \
--chuid ${CONSUL_USER:-consul}:${CONSUL_GROUP:-consul} \
--exec {{ bin_dir }}/consul agent -- \
-config-dir="/etc/consul.d" \
${CONSUL_FLAGS} \
>> /var/log/consul.log 2>&1
end script