Skip to content

Instantly share code, notes, and snippets.

@agibralter
Forked from digitalhobbit/gist:71143
Created May 19, 2009 04:47
Show Gist options
  • Save agibralter/113918 to your computer and use it in GitHub Desktop.
Save agibralter/113918 to your computer and use it in GitHub Desktop.
#!/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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment