Created
October 14, 2011 13:15
-
-
Save octplane/1287060 to your computer and use it in GitHub Desktop.
Simple sumr wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def should_i_start? | |
| puts "Should I ?" | |
| Time.now.min % 2 == 1 | |
| end | |
| def setup_watch(w) | |
| w.stop_if do |on| | |
| on.condition(:lambda) do |lam| | |
| lam.interval = 5.seconds | |
| lam.lambda = lambda { ! should_i_start? } | |
| end | |
| end | |
| w.restart_if do |on| | |
| on.condition(:lambda) do |lam| | |
| lam.interval = 5.seconds | |
| lam.lambda = lambda { should_i_start? } | |
| end | |
| end | |
| end | |
| God.watch do |w| | |
| w.name = "sumr" | |
| w.group = 'seasons' | |
| w.interval = 5.seconds | |
| w.dir = "/tmp/" | |
| w.start = "ruby /tmp/dru" | |
| w.log = "/tmp/dru.log" | |
| setup_watch(w) | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd expect this god configuration file to start my daemon and stop it every other minute. Unfortunately, after the first stop event, it never starts again.