anchor.diff:  
       echo -n $"Starting <%= @name %>: "
       daemon \
  -         --pidfile=$pidfile \
  -         --user=$user \
  -         " { $exec <%= @daemon_options %> >> $logfile 2>&1 & } ; echo \$! >| $pidfile "
  +        --pidfile=$pidfile \
  +        --user=$user \
  +        " { $exec <%= @daemon_options %> >> $logfile 2>&1 & } ; echo \$! >| $pidfile "
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch $lockfile
  
positive.code: }
  
  _wait_for_listening() {
    echo -n "Waiting for consul daemon to be listening..."
    for i in `seq 1 30`; do
      # if ! start-stop-daemon --quiet --stop --test --pidfile $pidfile --user $user; then
      if ! _status_q; then
        echo " FAIL: consul process died"
        return 2
      fi
      if "$exec" info >/dev/null; then
        echo " OK"
        return 0
      fi
      echo -n .
      sleep 1
    done
    echo " FAIL: consul process is alive, but is not listening."
    return 2
  }
  
  case "$1" in
  
negative.code: . /lib/lsb/init-functions
  
  _start() {
      touch $logfile
      chown $user $logfile
      echo "Starting consul"
      start-stop-daemon --start --quiet --background \
          --pidfile $pidfile<% unless @pid_file_external %> --make-pidfile<% end %> \
          --chuid $user --chdir "<%= @directory %>" \
          --startas /bin/bash -- -c "exec $exec <%= @daemon_options %> >> $logfile 2>&1"
  
      _wait_for_listening
  }
  
  _stop() {
      start-stop-daemon --stop --quiet --pidfile $pidfile --user $user --retry="<%= @stop_signal %>"/30/KILL/5
  }
  
  _status() {
      status_of_proc -p $pidfile $exec $prog
  }
  
  _reload() {
      start-stop-daemon --stop --quiet --pidfile $pidfile --user $user --signal "<%= @reload_signal %>"
  }
  
  <%- else -%>
  