diff options
author | Steve Kemp <steve@steve.org.uk> | 2012-11-12 22:39:46 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2012-11-12 22:39:46 +0000 |
commit | bd9fbb0ee556ff56211c0df944f7e478fb89cc14 (patch) | |
tree | f45bffb343f039eecf9cec8f455b919c5638aed9 | |
parent | 9c7ce90ac627adb7952a61f5125bcea62215283d (diff) |
Allow single-job execution via --single/-s
-rwxr-xr-x | worker/worker | 22 |
1 files changed, 21 insertions, 1 deletions
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 |