Class: GodUnmonitor
- Defined in:
- lib/bender/watchers/god_unmonitor.rb
Instance Method Summary collapse
-
#perform(message) ⇒ Object
Expects a message in the following format :task_or_group_name => ‘resque’.
Methods inherited from Watcher
#initialize, #load_queue, #name, #publish, #start, #subscribe
Constructor Details
This class inherits a constructor from Watcher
Instance Method Details
#perform(message) ⇒ Object
Expects a message in the following format
:task_or_group_name => 'resque'
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bender/watchers/god_unmonitor.rb', line 7 def perform() task_or_group_name = [:task_or_group_name] if task_or_group_name.nil? Bender.logger.warn("GodUnmonitor: task_or_group_name not defined - #{message}") return end Bender.logger.info("GodUnmonitor: #{task_or_group_name}") # TODO: sanitize input Open3.popen3("sudo god unmonitor #{task_or_group_name}") do |stdin, stdout, stderr, wait_thr| info = stdout.read error = stderr.read Bender.logger.info("GodUnmonitor: #{info.rstrip}") unless info.empty? Bender.logger.error("GodUnmonitor: #{error.rstrip}") unless error.empty? end end |