#!/usr/bin/env ruby require 'rubygems' require 'applix' $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'can-controls-gateway' $stderr.sync = true $stdout.sync = true Defaults = { } def main argv options = Defaults.merge(Hash.from_argv argv) puts " -- starting #{File.basename __FILE__} at #{Time.now}" args = (options.delete :args) #debugger if (defined? debugger) service_url = (args.shift || 'http://gom/services/ccg/home') puts " .. #{service_url}" service = nil daemon = Gom::Remote::Daemon.new(service_url, options) do |daemon, path| service = CcgRunner.new(path, options) daemon.redirect_log service.logfile daemon.check_in end daemon.background_loop(5) { service.run } daemon.actor_loop { |daemon| puts " -- gom refresh: #{Time.now}" } rescue => e puts " ## #{e}\n -> #{e.backtrace.join "\n "}" end main ARGV # vim: syntax=ruby