Fixes in the script template

This commit is contained in:
Emile Cantin 2012-04-24 17:04:00 -04:00
parent 75cdf3be4b
commit ab1594bc72

View File

@ -19,7 +19,9 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Runs <%= app %>" DESC="Runs <%= app %>"
NAME=<%= app %> NAME=<%= app %>
PIDDIR=/var/run/$NAME PIDDIR=/var/run/$NAME
LOGDIR=/var/log/$NAME
SCRIPTNAME=/etc/init.d/$NAME SCRIPTNAME=/etc/init.d/$NAME
USERNAME=<%= user %>
# Read configuration variable file if it is present # Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME [ -r /etc/default/$NAME ] && . /etc/default/$NAME
@ -38,6 +40,8 @@ SCRIPTNAME=/etc/init.d/$NAME
do_start() do_start()
{ {
mkdir -p $PIDDIR mkdir -p $PIDDIR
mkdir -p $LOGDIR
chown $USERNAME: $LOGDIR
# START APPLICATION: <%= app %> # START APPLICATION: <%= app %>
<% engine.procfile.entries.each do |process| %> <% engine.procfile.entries.each do |process| %>
# START PROCESS: <%= process.name %> # START PROCESS: <%= process.name %>
@ -45,7 +49,7 @@ do_start()
# START CONCURRENT: <%= num %> # START CONCURRENT: <%= num %>
# Start: <%= app %>.<%= process.name %>.<%= num %> # Start: <%= app %>.<%= process.name %>.<%= num %>
# Create $PIDDIR/<%= process.name %>.<%= num %>.pid # 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 %>
<% end %> <% end %>