From bd9fbb0ee556ff56211c0df944f7e478fb89cc14 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 12 Nov 2012 22:39:46 +0000 Subject: Allow single-job execution via --single/-s --- worker/worker | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'worker') diff --git a/worker/worker b/worker/worker index 386600a..33f6122 100755 --- a/worker/worker +++ b/worker/worker @@ -202,7 +202,8 @@ if __FILE__ == $0 then begin opts = GetoptLong.new( [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ], - [ "--flush", "-f", GetoptLong::NO_ARGUMENT ] + [ "--flush", "-f", GetoptLong::NO_ARGUMENT ], + [ "--single", "-s", GetoptLong::NO_ARGUMENT ] ) opts.each do |opt, arg| case opt @@ -210,6 +211,8 @@ if __FILE__ == $0 then ENV["VERBOSE"] = "1" when "--flush": ENV["FLUSH"] = "1" + when "--single": + ENV["SINGLE"] = "1" end end rescue StandardError => ex @@ -217,12 +220,29 @@ if __FILE__ == $0 then exit end + # + # Create the object + # worker = Custodian.new() + # + # Are we flushing the queue? + # if ( ENV['FLUSH'] ) worker.flush_queue! exit(0) end + # + # Single step? + # + if ( ENV['SINGLE'] ) + worker.process_single_job + exit(0) + end + + # + # Otherwise loop indefinitely + # worker.run! end -- cgit v1.2.1