github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/builtin/foundation/consul/data/common/app-dev/upstart.conf (about)

     1  description "Consul agent"
     2  
     3  start on runlevel [2345]
     4  stop on runlevel [!2345]
     5  
     6  respawn
     7  
     8  # This is to avoid Upstart re-spawning the process upon `consul leave`
     9  normal exit 0 INT
    10  
    11  # stop consul will not mark node as failed but left
    12  kill signal INT
    13  
    14  script
    15    if [ -f "/etc/service/consul" ]; then
    16      . /etc/service/consul
    17    fi
    18  
    19    # Make sure to use all our CPUs, because Consul can block a scheduler thread
    20    export GOMAXPROCS=`nproc`
    21  
    22    # Get the public IP
    23    BIND=`ifconfig eth0 | grep "inet addr" | awk '{ print substr($2,6) }'`
    24  
    25    exec /usr/local/bin/consul agent \
    26      -config-dir="/etc/consul.d" \
    27      -bind=$BIND \
    28      ${CONSUL_FLAGS} \
    29      >>/var/log/consul.log 2>&1
    30  end script