Sha256: 7d00aa60407eeb76460a3f0bd19e2d720a0d0d16cb90143bf1e9f5879099633f

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

class Fluentd
  class Agent
    class TdAgent
      include Common
      include LocalCommon

      def self.default_options
        {
          :pid_file => "/var/run/td-agent/td-agent.pid",
          :log_file => "/var/log/td-agent/td-agent.log",
          :config_file => "/etc/td-agent/td-agent.conf",
        }
      end

      def start
        detached_command('/etc/init.d/td-agent start')
      end

      def stop
        detached_command('/etc/init.d/td-agent stop')
      end

      def restart
        # NOTE: td-agent has no reload command
        # https://github.com/treasure-data/td-agent/blob/master/debian/td-agent.init#L156
        detached_command('/etc/init.d/td-agent restart')
      end

      def version
        `/usr/sbin/td-agent --version`.strip
      end

      private

      def detached_command(cmd)
        Bundler.with_clean_env do
          pid = spawn(cmd)
          Process.detach(pid)
        end
        sleep 1 # NOTE/FIXME: too early return will be caused incorrect status report, "sleep 1" is a adhoc hack
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fluentd-ui-0.3.2 app/models/fluentd/agent/td_agent.rb
fluentd-ui-0.3.1 app/models/fluentd/agent/td_agent.rb
fluentd-ui-0.3.0 app/models/fluentd/agent/td_agent.rb
fluentd-ui-0.2.0 app/models/fluentd/agent/td_agent.rb
fluentd-ui-0.1.4 app/models/fluentd/agent/td_agent.rb
fluentd-ui-0.1.3 app/models/fluentd/agent/td_agent.rb
fluentd-ui-0.1.2 app/models/fluentd/agent/td_agent.rb
fluentd-ui-0.1.1 app/models/fluentd/agent/td_agent.rb
fluentd-ui-0.1.0 app/models/fluentd/agent/td_agent.rb