github.hscsec.cn/hashicorp/consul@v1.4.5/terraform/openstack/scripts/upstart.conf (about)

     1  description "Consul agent"
     2  
     3  start on runlevel [2345]
     4  stop on runlevel [!2345]
     5  
     6  respawn
     7  
     8  script
     9    if [ -f "/etc/service/consul" ]; then
    10      . /etc/service/consul
    11    fi
    12  
    13    # Make sure to use all our CPUs, because Consul can block a scheduler thread
    14    export GOMAXPROCS=`nproc`
    15  
    16    # Get the public IP
    17    BIND=`ifconfig eth0 | grep "inet addr" | awk '{ print substr($2,6) }'`
    18  
    19    exec /usr/local/bin/consul agent \
    20      -config-dir="/etc/consul.d" \
    21      -bind=$BIND \
    22      ${CONSUL_FLAGS} \
    23      >>/var/log/consul.log 2>&1
    24  end script