diff --git a/data/export/initscript/master.erb b/data/export/initscript/master.erb index 6e58eed..954f223 100644 --- a/data/export/initscript/master.erb +++ b/data/export/initscript/master.erb @@ -19,7 +19,9 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="Runs <%= app %>" NAME=<%= app %> PIDDIR=/var/run/$NAME +LOGDIR=/var/log/$NAME SCRIPTNAME=/etc/init.d/$NAME +USERNAME=<%= user %> # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME @@ -38,6 +40,8 @@ SCRIPTNAME=/etc/init.d/$NAME do_start() { mkdir -p $PIDDIR + mkdir -p $LOGDIR + chown $USERNAME: $LOGDIR # START APPLICATION: <%= app %> <% engine.procfile.entries.each do |process| %> # START PROCESS: <%= process.name %> @@ -45,7 +49,7 @@ do_start() # START CONCURRENT: <%= num %> # Start: <%= app %>.<%= process.name %>.<%= num %> # Create $PIDDIR/<%= process.name %>.<%= num %>.pid - exec su - <%= user %> -c 'cd <%= engine.directory %>; export PORT=<%= engine.port_for(process, num, self.port) %>;<% engine.environment.each_pair do |var,env| %> export <%= var.upcase %>=<%= env %>; <% end %> <%= process.command %> >> <%= log_root %>/<%=process.name%>-<%=num%>.log 2>&1 & echo $!' > $PIDDIR/<%= process.name %>.<%= num %>.pid + exec su - USERNAME -c 'cd <%= engine.directory %>; export PORT=<%= engine.port_for(process, num, self.port) %>;<% engine.environment.each_pair do |var,env| %> export <%= var.upcase %>=<%= env %>; <% end %> <%= process.command %> >> <%= log_root %>/<%=process.name%>-<%=num%>.log 2>&1 & echo $!' > $PIDDIR/<%= process.name %>.<%= num %>.pid <% end %> <% end %>