Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Would like to add a shell return conditional which would be nice #105

Open
wants to merge 2 commits into from

1 participant

@blu3man

This gem is missing a condition which allows people to monitor a process of say, an init script... or custom commands etc.

I would like to monitor processes based apon the return of a shell command (ie an init script).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 7, 2012
  1. @blu3man

    adding a condition to check a shell return for the purposes of checki…

    blu3man authored Ben Kaehne committed
    …ng init script returns
This page is out of date. Refresh to see the latest.
Showing with 24 additions and 0 deletions.
  1. +24 −0 lib/god/conditions/Shrtn.rb
View
24 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
Something went wrong with that request. Please try again.