Compare commits

..
2 Commits
Author SHA1 Message Date
David Dollar d0f5b2412c 0.7.4 2010-09-17 09:30:20 -04:00
David Dollar 15ab54bc18 include files from export in the gem 2010-09-17 09:30:09 -04:00
3 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -3,4 +3,4 @@ stop on stopping <%= app %>-<%= process.name %>
respawn respawn
chdir <%= engine.directory %> chdir <%= engine.directory %>
exec su - <%= user %> -c 'export PORT=<%= port %>; <%= process.command %> >> <%= log_root %>/<%=process.name%>-<%=num%>.log 2>&1' exec su <%= user %> -c "PORT=<%= port %> <%= process.command %> >> <%= log_root %>/<%=process.name%>-<%=num%>.log 2>&1"
+1 -1
View File
@@ -1,6 +1,6 @@
module Foreman module Foreman
VERSION = "0.8.0" VERSION = "0.7.4"
class AppDoesNotExist < Exception; end class AppDoesNotExist < Exception; end
+7 -7
View File
@@ -39,8 +39,8 @@ class Foreman::Engine
fork process, options fork process, options
end end
trap("TERM") { puts "SIGTERM received"; kill_all("TERM") } trap("TERM") { kill_and_exit("TERM") }
trap("INT") { puts "SIGINT received"; kill_all("INT") } trap("INT") { kill_and_exit("INT") }
watch_for_termination watch_for_termination
end end
@@ -48,8 +48,8 @@ class Foreman::Engine
def execute(name, options={}) def execute(name, options={})
fork processes[name], options fork processes[name], options
trap("TERM") { puts "SIGTERM received"; kill_all("TERM") } trap("TERM") { kill_and_exit("TERM") }
trap("INT") { puts "SIGINT received"; kill_all("INT") } trap("INT") { kill_and_exit("INT") }
watch_for_termination watch_for_termination
end end
@@ -100,12 +100,13 @@ private ######################################################################
end end
end end
def kill_all(signal="TERM") def kill_and_exit(signal="TERM")
info "terminating" info "terminating"
running_processes.each do |pid, process| running_processes.each do |pid, process|
info "killing #{process.name} in pid #{pid}" info "killing #{process.name} in pid #{pid}"
Process.kill(signal, pid) Process.kill(signal, pid)
end end
exit 0
end end
def info(message, process=nil) def info(message, process=nil)
@@ -148,8 +149,7 @@ private ######################################################################
pid, status = Process.wait2 pid, status = Process.wait2
process = running_processes.delete(pid) process = running_processes.delete(pid)
info "process terminated", process info "process terminated", process
kill_all kill_and_exit
Process.waitall
end end
def running_processes def running_processes