start on starting <%= app %>-<%= name %>
stop on stopping <%= app %>-<%= name %>
respawn

env PORT=<%= port %>
<% File.readlines('/etc/environment').delete_if { |line| line.start_with? 'PATH=' }.each do |line| -%>
env <%= line -%>
<% end -%>
<% engine.env.each do |name,value| -%>
env <%= name.upcase %>='<%= value.gsub(/'/, "'\"'\"'") %>'
<% end -%>

setuid <%= user %>

chdir <%= engine.root %>

exec echo "<%= process.command %>" | bash --login

start on starting <%= app %>-<%= name %>
stop on stopping <%= app %>-<%= name %>
respawn

env PORT=<%= port %>
<% if File.exist?('/etc/environment') -%>
<% File.readlines('/etc/environment').delete_if { |line| line.start_with? 'PATH=' }.each do |line| -%>
env <%= line -%>
<% end -%>
<% end -%>
<% engine.env.each do |name,value| -%>
env <%= name.upcase %>='<%= value.gsub(/'/, "'\"'\"'") %>'
<% end -%>

setuid <%= user %>

chdir <%= engine.root %>

exec echo "<%= process.command %>" | bash --login

Add a test in the templates for whether '/etc/environments' exists
Add a test in the templates for whether '/etc/environments' exists
