From 9f92632884735eb6a14d5a8b68d8b65818b0ab22 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 2 Jan 2013 08:27:02 -0500 Subject: [PATCH] fix to init script --- data/export/initscript/master.erb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/data/export/initscript/master.erb b/data/export/initscript/master.erb index aa3f9a5..38a7fa5 100644 --- a/data/export/initscript/master.erb +++ b/data/export/initscript/master.erb @@ -50,7 +50,7 @@ do_start() # START CONCURRENT: <%= num %> # Start: <%= app %>.<%= name %>.<%= num %> # Create $PIDDIR/<%= name %>.<%= num %>.pid - if [ ! -f $PID_DIR/<%= name %>-<%= num %>.pid ]; then + if [ ! -f $PIDDIR/<%= 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 @@ -71,9 +71,11 @@ do_stop() <% 1.upto(engine.formation[name]) do |num| %> # STOP CONCURRENT: <%= num %> # Stop: <%= app %>.<%= name %>.<%= num %> - echo -n "<%= name %>-<%= num %> " - kill `cat $PIDDIR/<%= name %>.<%= num %>.pid` - rm $PIDDIR/<%= name %>.<%= num %>.pid + if [ -f $PIDDIR/<%= name %>.<%= num %>.pid ]; then + echo -n "<%= name %>-<%= num %> " + kill `cat $PIDDIR/<%= name %>.<%= num %>.pid` + rm $PIDDIR/<%= name %>.<%= num %>.pid + fi <% end %> <% end %> rmdir $PIDDIR