description "Consul Service Discovery Platform"

emits consul-up

start on runlevel [2345]
stop on runlevel [!2345]

script
  if [ -f <%= node['consul']['etc_config_dir'] %> ]; then
    . <%= node['consul']['etc_config_dir'] %>
  fi
  export GOMAXPROCS=${GOMAXPROCS}
  CMD="<%= @consul_binary %> agent -config-dir <%= @config_dir %>"
  LOGFILE="/var/log/consul.log"
  exec $CMD >> "$LOGFILE"
end script

post-start exec initctl emit consul-up

kill signal INT

description "Consul Service Discovery Platform"

emits consul-up

start on runlevel [2345]
stop on runlevel [!2345]

script
  if [ -f <%= node['consul']['etc_config_dir'] %> ]; then
    . <%= node['consul']['etc_config_dir'] %>
  fi
  export GOMAXPROCS=${GOMAXPROCS}
  CMD="<%= @consul_binary %> agent -config-dir <%= @config_dir %>"
  LOGFILE="/var/log/consul.log"
  exec $CMD >> "$LOGFILE"
end script

post-start exec initctl emit consul-up

kill signal INT

respawn
respawn limit 10 10

Make upstart script respawn consul on crash
Make upstart script respawn consul on crash
