2015-10-07 14:18:22 -04:00
|
|
|
description "Consul agent"
|
|
|
|
|
|
|
|
start on runlevel [2345]
|
|
|
|
stop on runlevel [!2345]
|
|
|
|
|
|
|
|
respawn
|
|
|
|
|
|
|
|
script
|
2017-11-28 05:16:19 -05:00
|
|
|
if [ -f /etc/default/consul ]; then
|
|
|
|
. /etc/default/consul
|
2015-10-07 14:18:22 -04:00
|
|
|
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) }'`
|
|
|
|
|
2017-11-28 05:16:19 -05:00
|
|
|
exec start-stop-daemon --start \
|
|
|
|
--chuid ${CONSUL_USER:-consul}:${CONSUL_GROUP:-consul} \
|
2019-01-21 20:09:01 -05:00
|
|
|
--exec /opt/consul/bin/consul agent -- \
|
2015-10-07 14:18:22 -04:00
|
|
|
-config-dir="/etc/consul.d" \
|
|
|
|
${CONSUL_FLAGS} \
|
|
|
|
>> /var/log/consul.log 2>&1
|
|
|
|
end script
|