fix to init script

This commit is contained in:
John Bintz 2013-01-02 08:27:02 -05:00
parent 8b83472437
commit 9f92632884

View File

@ -50,7 +50,7 @@ do_start()
# START CONCURRENT: <%= num %> # START CONCURRENT: <%= num %>
# Start: <%= app %>.<%= name %>.<%= num %> # Start: <%= app %>.<%= name %>.<%= num %>
# Create $PIDDIR/<%= name %>.<%= num %>.pid # Create $PIDDIR/<%= name %>.<%= num %>.pid
if [ ! -f $PID_DIR/<%= name %>-<%= num %>.pid ]; then if [ ! -f $PIDDIR/<%= name %>-<%= num %>.pid ]; then
echo -n "<%= name %>-<%= num %> " echo -n "<%= name %>-<%= num %> "
su - $USERNAME -c 'cd <%= engine.root %>; export PORT=<%= engine.port_for(process, num) %>;<% engine.environment.each_pair do |var,env| %> export <%= var.upcase %>=<%= env %>; <% end %> <%= process.command %> >> <%= log %>/<%=name%>-<%=num%>.log 2>&1 & echo $!' > $PIDDIR/<%= name %>.<%= num %>.pid su - $USERNAME -c 'cd <%= engine.root %>; export PORT=<%= engine.port_for(process, num) %>;<% engine.environment.each_pair do |var,env| %> export <%= var.upcase %>=<%= env %>; <% end %> <%= process.command %> >> <%= log %>/<%=name%>-<%=num%>.log 2>&1 & echo $!' > $PIDDIR/<%= name %>.<%= num %>.pid
fi fi
@ -71,9 +71,11 @@ do_stop()
<% 1.upto(engine.formation[name]) do |num| %> <% 1.upto(engine.formation[name]) do |num| %>
# STOP CONCURRENT: <%= num %> # STOP CONCURRENT: <%= num %>
# Stop: <%= app %>.<%= name %>.<%= num %> # Stop: <%= app %>.<%= name %>.<%= num %>
if [ -f $PIDDIR/<%= name %>.<%= num %>.pid ]; then
echo -n "<%= name %>-<%= num %> " echo -n "<%= name %>-<%= num %> "
kill `cat $PIDDIR/<%= name %>.<%= num %>.pid` kill `cat $PIDDIR/<%= name %>.<%= num %>.pid`
rm $PIDDIR/<%= name %>.<%= num %>.pid rm $PIDDIR/<%= name %>.<%= num %>.pid
fi
<% end %> <% end %>
<% end %> <% end %>
rmdir $PIDDIR rmdir $PIDDIR