From e49b27e28164e311e5224e2a3d1a837b1a9c215b Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 13 Nov 2012 09:04:01 +0000 Subject: Allow the beanstalkd to be specified. --- worker/worker | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'worker') diff --git a/worker/worker b/worker/worker index 33f6122..5fcd312 100755 --- a/worker/worker +++ b/worker/worker @@ -43,8 +43,7 @@ require 'tests/ssh' # -# This class encapsulates the raising and clearing of alerts -# via Mauve. +# This class encapsulates the raising and clearing of alerts via Mauve. # class Alert @@ -81,8 +80,8 @@ class Custodian # # Constructor: Connect to the queue # - def initialize - @queue = Beanstalk::Pool.new(['localhost:11300']) + def initialize( server ) + @queue = Beanstalk::Pool.new([server]) end @@ -198,11 +197,13 @@ end # if __FILE__ == $0 then + $SERVER = "localhost:11300"; begin opts = GetoptLong.new( [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ], [ "--flush", "-f", GetoptLong::NO_ARGUMENT ], + [ "--server", "-S", GetoptLong::REQUIRED_ARGUMENT ], [ "--single", "-s", GetoptLong::NO_ARGUMENT ] ) opts.each do |opt, arg| @@ -211,6 +212,8 @@ if __FILE__ == $0 then ENV["VERBOSE"] = "1" when "--flush": ENV["FLUSH"] = "1" + when "--server": + ENV["SERVER"] = arg when "--single": ENV["SINGLE"] = "1" end @@ -223,7 +226,7 @@ if __FILE__ == $0 then # # Create the object # - worker = Custodian.new() + worker = Custodian.new( $SERVER ) # # Are we flushing the queue? -- cgit v1.2.1