Sha256: 9352d9c7961002149838406d4c024ca213a03283f2f161c7dcc7bbcb26889441

Contents?: true

Size: 830 Bytes

Versions: 1

Compression:

Stored size: 830 Bytes

Contents

#!/usr/bin/env ruby

INIT_SCRIPT = "/etc/init.d/td-agent"
event = ENV['SERF_EVENT']
user_event = ENV['SERF_USER_EVENT']
td_agent_event = user_event[9..-1] if user_event and user_event.start_with?('td-agent-')

if ARGV[0] == "-h"
  puts "Usage: SERF_EVENT=user SERF_USER_EVENT={event} #{$PROGRAM_NAME}"
  puts ""
  puts "AVAILABLE EVENTS:"
  puts "  td-agent-start"
  puts "  td-agent-stop"
  puts "  td-agent-reload"
  puts "  td-agent-restart"
  puts "  td-agent-condrestart"
  puts "  td-agent-status"
  puts "  td-agent-configtest"
  puts ""
  puts "WITH SERF:"
  puts "  serf event {event}"
  exit 0
end

status = 0
case event
when "user"
  case td_agent_event
  when "start", "stop", "reload", "restart", "condrestart", "status", "configtest"
    status = system "sudo #{INIT_SCRIPT} #{td_agent_event}"
  end
end
exit status

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
serf-td-agent-0.0.1 bin/serf-td-agent