From ab1594bc72311402c38b4fc537267470b71fbd68 Mon Sep 17 00:00:00 2001 From: Emile Cantin Date: Tue, 24 Apr 2012 17:04:00 -0400 Subject: [PATCH] Fixes in the script template --- data/export/initscript/master.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 %>