bin/serf-td-agent in serf-td-agent-0.0.1 vs bin/serf-td-agent in serf-td-agent-0.1.0
- old
+ new
@@ -1,33 +1,32 @@
#!/usr/bin/env ruby
INIT_SCRIPT = "/etc/init.d/td-agent"
event = ENV['SERF_EVENT']
-user_event = ENV['SERF_USER_EVENT']
+user_event = ENV['SERF_USER_EVENT'] || ENV['SERF_QUERY_NAME']
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 "Usage: SERF_EVENT=user SERF_USER_EVENT={event} #{File.basename($PROGRAM_NAME)}"
+ puts "Usage: SERF_EVENT=query SERF_QUERY_NAME={query} #{File.basename($PROGRAM_NAME)}"
puts ""
- puts "AVAILABLE EVENTS:"
+ puts "AVAILABLE EVENTS|QUERIES:"
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}"
+ puts " serf query {query}"
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
+case td_agent_event
+when "start", "stop", "reload", "restart", "condrestart", "status", "configtest"
+ status = system "sudo #{INIT_SCRIPT} #{td_agent_event}"
end
exit status