# <%= @name %> generated by poise-service

description "<%= @name %>"

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

respawn
respawn limit 10 5
umask 022
chdir <%= @directory %>
<%- @environment.each do |key, val| -%>
env <%= key %>="<%= val %>"
<%- end -%>
<%- if @upstart_features[:setuid] -%>
setuid <%= @user %>
<%- end -%>
<%- if @upstart_features[:kill_signal] -%>
kill signal <%= @stop_signal %>
<%- end -%>
<%- if @upstart_features[:reload_signal] -%>
reload signal <%= @reload_signal %>
<%- end -%>

exec <% if !@upstart_features[:setuid]  %>su -s /bin/sh -c 'exec "$0" "$@"' <%= @user %> -- <% end %><%= @command %>
<%- if !@upstart_features[:kill_signal]  && @stop_signal != 'TERM' -%>
pre-stop script
  . /etc/rc.d/init.d/functions
  killproc -G<% if @pid_file %> -p "<%= @pid_file %>"<% end %> -<%= @stop_signal%> "<%= @command.split(/ /, 2).first %>"
end script
<%- end -%>

# <%= @name %> generated by poise-service

description "<%= @name %>"

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

respawn
respawn limit 10 5
umask 022
chdir <%= @directory %>
<%- @environment.each do |key, val| -%>
env <%= key %>="<%= val %>"
<%- end -%>
<%- if @upstart_features[:setuid] -%>
setuid <%= @user %>
<%- end -%>
<%- if @upstart_features[:kill_signal] -%>
kill signal <%= @stop_signal %>
<%- end -%>
<%- if @upstart_features[:reload_signal] -%>
reload signal <%= @reload_signal %>
<%- end -%>

exec <% if !@upstart_features[:setuid]  %>su -s /bin/sh -c 'exec "$0" "$@"' <%= @user %> -- <% end %><%= @command %>
<%- if !@upstart_features[:kill_signal]  && @stop_signal != 'TERM' -%>
pre-stop script
  . /etc/rc.d/init.d/functions
  killproc<% if @pid_file %> -p "<%= @pid_file %>"<% end %> "<%= @command.split(/ /, 2).first %>" -<%= @stop_signal%>
end script
<%- end -%>

Fix up the probably-non-functional fallback stop_signal support.
Fix up the probably-non-functional fallback stop_signal support.