#!/usr/bin/env ruby require 'rubygems' require 'daemons' # This is a bit hacky, but we don't have a clean way to hook into the parsed # options, as Daemons is managing these internally. number = 0 for i in 0..ARGV.length if ARGV[i] == '--number' number = ARGV[i + 1] 2.times {ARGV.delete_at(i)} end end puts "Workling Number: #{number}" workling = File.join(File.dirname(__FILE__), '..', 'vendor', 'plugins', 'workling', 'script', 'listen.rb') options = { :app_name => "workling#{number}", :ARGV => ARGV, :dir_mode => :normal, :dir => File.join(File.dirname(__FILE__), '..', 'log'), :log_output => true, :multiple => false, :backtrace => true, :monitor => false } Daemons.run(workling, options)