# this script originally created by https://github.com/witscher
description "Tomcat Server <%= @instance -%>"

  start on runlevel [2345]
  stop on runlevel [!2345]
  respawn
  respawn limit 10 5

  setuid tomcat_<%= @instance %>
  setgid tomcat_<%= @instance %>

  <% @env_vars.each do |h| -%>
    <% h.each_pair do |k,v| -%>
  env <%= k -%>="<%= v -%>"
    <% end -%>
  <% end -%>

  exec $CATALINA_HOME/bin/catalina.sh start

  # cleanup temp directory after stop
  post-stop script
    rm -rf $CATALINA_HOME/temp/*
  end script

# this script originally created by https://github.com/witscher
description "Tomcat Server <%= @instance -%>"

  start on runlevel [2345]
  stop on runlevel [!2345]
  respawn
  respawn limit 10 5

  setuid tomcat_<%= @instance %>
  setgid tomcat_<%= @instance %>

  <% @env_vars.each do |h| -%>
    <% h.each_pair do |k,v| -%>
  env <%= k -%>="<%= v -%>"
    <% end -%>
  <% end -%>

  exec $CATALINA_BASE/bin/catalina.sh run

  # cleanup temp directory after stop
  post-stop script
    rm -rf $CATALINA_BASE/temp/*
  end script

Fix upstart script to function
Fix upstart script to function
