Class: Sad::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/sad/runner.rb

Class Method Summary collapse

Class Method Details

.exec(opts = {}) ⇒ Object

Example:

options = {
  :app_name   => "my_app",
  :ARGV       => ['start', '-f', '--', 'param_for_myscript']
  :dir_mode   => :script,
  :dir        => 'pids',
  :multiple   => true,
  :ontop      => true,
  :mode       => :exec,
  :backtrace  => true,
  :monitor    => true
}


19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/sad/runner.rb', line 19

def self.exec(opts={})
	count = (ENV['COUNT'] && ENV['COUNT'].to_i)

	if count and count != 0
		count.times do |t|
			Daemons.run_proc("Sad-#{Sad::Config.queue(ENV['QUEUE'])}-#{t+1}", opts) do
				EM.run{
					Sad.logger.reopen
					Sad::Server.run(ENV['QUEUE'])
				}
			end
		end
	end
end