Sha256: b8ddfc8036169b0efc47928652fb05e2c0713f0208ed7093cc29e79f7bb141c3

Contents?: true

Size: 662 Bytes

Versions: 8

Compression:

Stored size: 662 Bytes

Contents

require "daemons"

module Sad
	class Runner

		# === 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
		#   }

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sad-1.5.3 lib/sad/runner.rb
sad-1.5.2 lib/sad/runner.rb
sad-1.5.1 lib/sad/runner.rb
sad-1.5.0 lib/sad/runner.rb
sad-1.4.0 lib/sad/runner.rb
sad-1.3.0 lib/sad/runner.rb
sad-1.2.0 lib/sad/runner.rb
sad-1.1.0 lib/sad/runner.rb