Sha256: 4c513a10aa4f32319ee1e76a7d6753bf7390e12f4e9dfc095b5db2ab98852b43

Contents?: true

Size: 757 Bytes

Versions: 7

Compression:

Stored size: 757 Bytes

Contents

class Fluentd
  class Agent
    class TdAgent
      module Macosx

        def start
          detached_command("launchctl load #{plist}") && pid_from_launchctl
        end

        def stop
          detached_command("launchctl unload #{plist}") && FileUtils.rm(pid_file)
        end

        def restart
          stop && start
        end

        private

        def plist
          '/Library/LaunchDaemons/td-agent.plist'
        end

        def pid_from_launchctl
          # NOTE: launchctl doesn't make pidfile, so detect pid and store it to pidfile manually
          pid = `launchctl list | grep td-agent | cut -f1`.strip
          return if pid == ""
          File.open(pid_file, "w"){|f| f.write pid }
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fluentd-ui-0.3.10 app/models/fluentd/agent/td_agent/macosx.rb
fluentd-ui-0.3.9 app/models/fluentd/agent/td_agent/macosx.rb
fluentd-ui-0.3.8 app/models/fluentd/agent/td_agent/macosx.rb
fluentd-ui-0.3.7 app/models/fluentd/agent/td_agent/macosx.rb
fluentd-ui-0.3.6 app/models/fluentd/agent/td_agent/macosx.rb
fluentd-ui-0.3.5 app/models/fluentd/agent/td_agent/macosx.rb
fluentd-ui-0.3.3 app/models/fluentd/agent/td_agent/macosx.rb