better starting
This commit is contained in:
parent
7f3f81422e
commit
6ebaa121e3
@ -41,6 +41,8 @@ do_start()
|
|||||||
mkdir -p $PIDDIR
|
mkdir -p $PIDDIR
|
||||||
mkdir -p <%= log %>
|
mkdir -p <%= log %>
|
||||||
chown $USERNAME: <%= log %>
|
chown $USERNAME: <%= log %>
|
||||||
|
|
||||||
|
echo -n "Starting <%= app %>: "
|
||||||
# START APPLICATION: <%= app %>
|
# START APPLICATION: <%= app %>
|
||||||
<% engine.each_process do |name, process| %>
|
<% engine.each_process do |name, process| %>
|
||||||
# START PROCESS: <%= name %>
|
# START PROCESS: <%= name %>
|
||||||
@ -48,10 +50,13 @@ 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
|
||||||
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
|
if [ ! -f $PID_DIR/<%= name %>-<%= num %>.pid ]; then
|
||||||
|
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
|
||||||
|
fi
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
echo " done"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -59,17 +64,20 @@ do_start()
|
|||||||
#
|
#
|
||||||
do_stop()
|
do_stop()
|
||||||
{
|
{
|
||||||
|
echo -n "Stopping <%= app %>: "
|
||||||
# STOP APPLICATION: <%= app %>
|
# STOP APPLICATION: <%= app %>
|
||||||
<% engine.each_process do |name, process| %>
|
<% engine.each_process do |name, process| %>
|
||||||
# STOP PROCESS: <%= name %>
|
# STOP PROCESS: <%= name %>
|
||||||
<% 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 %>
|
||||||
|
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
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
rmdir $PIDDIR
|
rmdir $PIDDIR
|
||||||
|
echo " done"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
Loading…
Reference in New Issue
Block a user