summaryrefslogtreecommitdiffstats
path: root/script/poller
blob: 9a4ee3fe7c7a8cd08e19c88b05db66a6368cdeb4 (plain)
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
# encoding: utf-8

if RUBY_VERSION < '1.9'
  $KCODE = 'u'
else
  Encoding.default_internal = Encoding::UTF_8
  Encoding.default_external = Encoding::UTF_8
end

require 'rubygems' if RUBY_VERSION < '1.9'
require 'daemons'

APP_ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
script_file = File.join(File.expand_path(APP_ROOT),'vendor','plugins','activemessaging','poller.rb')
tmp_dir = File.join(File.expand_path(APP_ROOT), 'tmp/pids')

options = {
  :app_name   => "poller",
  :dir_mode   => :normal,
  :dir        => tmp_dir,
  :multiple   => true,
  :ontop      => false,
  :mode       => :load,
  :backtrace  => true,
  :monitor    => false,
  :log_output => true
}

Daemons.run(script_file,options)