Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 92252f759f
Fetching contributors…

Cannot retrieve contributors at this time

executable file 36 lines (28 sloc) 0.986 kB
#!/usr/bin/env ruby
$: << File.dirname(__FILE__) + '/../lib' unless $:.include?(File.dirname(__FILE__) + '/../lib/')
require 'rubygems'
require 'daemons'
require 'fileutils'
require 'flapjack/cli/worker_manager'
require 'flapjack/patches' # for Daemons
# reassign ARGV so we don't mess with it directly
args = ARGV
args << '--help' if args.size == 0
options = WorkerManagerOptions.parse(args)
worker_path = File.join(File.dirname(__FILE__), 'flapjack-worker')
# set up pid dir
pid_dir = "/var/run/flapjack"
FileUtils.mkdir_p(pid_dir)
# spin up a number of workers (5 is the default).
options.workers.times do |n|
# we fork for each worker, as Daemons.run backgrounds this script.
fork do
Daemons.run(worker_path,
:ARGV => (args + %w(-- -b localhost)),
:multiple => true,
:dir_mode => :normal,
:dir => pid_dir)
end
# so we don't try and stop the daemon multiple times
break if ARGV[0] == "stop"
end
Jump to Line
Something went wrong with that request. Please try again.