Forks

Revisions

  • 05336b digital... Thu Feb 26 14:01:54 -0800 2009
gist: 71143 Download_button fork
public
Public Clone URL: git://gist.github.com/71143.git
Ruby
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/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)