From ea724bae8f2dc3886f0a3fd540d9b56eba3d4abe Mon Sep 17 00:00:00 2001 From: Ben Kaehne Date: Sat, 21 Jan 2012 12:44:46 -0800 Subject: [PATCH] adding a condition to check a shell return for the purposes of checking init script returns --- History.txt | 4 ++++ god.gemspec | 4 ++-- lib/god.rb | 2 +- lib/god/conditions/Shrtn.rb | 24 ++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 lib/god/conditions/Shrtn.rb diff --git a/History.txt b/History.txt index e6b01eb1..fcb03184 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,7 @@ +== 0.12.1 + * Bug Fixes + * Fix undefined variable problem in CLI (#82) + == 0.12.0 * Minor Enhancements * Add umask support diff --git a/god.gemspec b/god.gemspec index 819ad8df..52e70411 100644 --- a/god.gemspec +++ b/god.gemspec @@ -3,8 +3,8 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.name = 'god' - s.version = '0.12.0' - s.date = '2012-01-13' + s.version = '0.12.1' + s.date = '2012-01-21' s.summary = "Process monitoring framework." s.description = "An easy to configure, easy to extend monitoring framework written in Ruby." diff --git a/lib/god.rb b/lib/god.rb index 4658f229..eb8318f4 100644 --- a/lib/god.rb +++ b/lib/god.rb @@ -151,7 +151,7 @@ def safe_attr_accessor(*args) module God # The String version number for this package. - VERSION = '0.12.0' + VERSION = '0.12.1' # The Integer number of lines of backlog to keep for the logger. LOG_BUFFER_SIZE_DEFAULT = 100 diff --git a/lib/god/conditions/Shrtn.rb b/lib/god/conditions/Shrtn.rb new file mode 100644 index 00000000..523158ee --- /dev/null +++ b/lib/god/conditions/Shrtn.rb @@ -0,0 +1,24 @@ +module God + module Conditions + class Shrtn < PollCondition + attr_accessor :shellcmd + + def valid? + valid = true + valid &= complain("Attribute 'shellcmd' must be specified", self) if self.shellcmd.nil? + valid + end + + def test + system "#{shellcmd}" + if $? == 0 + self.info = "OK" + false + else + self.info = "Process has currently been found not running" + true + end + end + end + end +end