lib/god.rb in god-0.7.8 vs lib/god.rb in god-0.7.10
- old
+ new
@@ -47,17 +47,27 @@
require 'god/conditions/degrading_lambda'
require 'god/conditions/flapping'
require 'god/conditions/http_response_code'
require 'god/conditions/disk_usage'
require 'god/conditions/complex'
+require 'god/conditions/file_mtime'
require 'god/contact'
require 'god/contacts/email'
+require 'god/contacts/webhook'
begin
+ require 'god/contacts/twitter'
+rescue LoadError
+end
+begin
require 'god/contacts/jabber'
rescue LoadError
end
+begin
+ require 'god/contacts/campfire'
+rescue LoadError
+end
require 'god/socket'
require 'god/driver'
require 'god/metric'
@@ -136,11 +146,11 @@
end
end
end
module God
- VERSION = '0.7.8'
+ VERSION = '0.7.10'
LOG_BUFFER_SIZE_DEFAULT = 100
PID_FILE_DIRECTORY_DEFAULTS = ['/var/run/god', '~/.god/pids']
DRB_PORT_DEFAULT = 17165
DRB_ALLOW_DEFAULT = ['127.0.0.1']
@@ -467,9 +477,22 @@
info = {}
self.watches.map do |name, w|
info[name] = {:state => w.state, :group => w.group}
end
info
+ end
+
+ # Send a signal to each task.
+ # +name+ is the String name of the task or group
+ # +signal+ is the signal to send. e.g. HUP, 9
+ #
+ # Returns String[]:task_names
+ def self.signal(name, signal)
+ items = Array(self.watches[name] || self.groups[name]).dup
+ jobs = []
+ items.each { |w| jobs << Thread.new { w.signal(signal) } }
+ jobs.each { |j| j.join }
+ items.map { |x| x.name }
end
# Log lines for the given task since the specified time.
# +watch_name+ is the name of the task (may be abbreviated)
# +since+ is the Time since which to report log lines