summaryrefslogtreecommitdiff
path: root/bin/custodian-dequeue
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-14 09:02:56 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-14 09:02:56 +0000
commitada7765a83d7112c44c64a65e3c7b5972a2df8fd (patch)
tree55c49d63011bcbc704ed62676084668aa18933f2 /bin/custodian-dequeue
parent51abd2f27de80cfdb49ea46e9c9b73e7aaf778a6 (diff)
Allow the logfile to be specified.
Diffstat (limited to 'bin/custodian-dequeue')
-rwxr-xr-xbin/custodian-dequeue26
1 files changed, 18 insertions, 8 deletions
diff --git a/bin/custodian-dequeue b/bin/custodian-dequeue
index 9edc353..99ea63f 100755
--- a/bin/custodian-dequeue
+++ b/bin/custodian-dequeue
@@ -6,10 +6,11 @@
# SYNOPSIS
# custodian-dequeue [ -h | --help ]
# [ -m | --manual]
-# [ --server 1.2.3.4:123 ]
+# [ -f | --flush ]
+# [ -l | --logfile FILE]
+# [ -S | --server 1.2.3.4:123 ]
# [ -s | --single ]
# [ -v | --verbose ]
-# [ -f | --flush ]
#
# OPTIONS
#
@@ -19,10 +20,15 @@
#
# -f, --flush Flush the queue, removing all jobs.
#
+# -l, --logfile Specify the path to the logfile to run.
+#
+# -S, --server Specify the host:port for the beanstalkd queue.
+#
# -s, --single Run a single test and exit. Don't poll the queue for more.
#
# -v, --verbose Be noisy.
#
+#
# ABOUT
#
# This tool is designed to pull JSON-encoded network/protocol-tests from
@@ -156,13 +162,13 @@ class Custodian
#
# Constructor: Connect to the queue
#
- def initialize( server )
+ def initialize( server, logfile )
# Connect to the queue
@queue = Beanstalk::Pool.new([server])
# Instantiate the logger.
- @logger = Logger.new( "worker.log", "daily" )
+ @logger = Logger.new( logfile, "daily" )
if ( ENV['REPEAT'] )
@retry_count=ENV['REPEAT'].to_i
@@ -343,15 +349,17 @@ end
#
if __FILE__ == $0 then
- $SERVER = "127.0.0.1:11300"
- $help = false
- $manual = false
+ $SERVER = "127.0.0.1:11300"
+ $LOGFILE = "custodian-dequeue.log"
+ $help = false
+ $manual = false
begin
opts = GetoptLong.new(
[ "--flush", "-f", GetoptLong::NO_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
[ "--manual", "-m", GetoptLong::NO_ARGUMENT ],
+ [ "--logfile", "-l", GetoptLong::REQUIRED_ARGUMENT ],
[ "--repeat", "-r", GetoptLong::REQUIRED_ARGUMENT ],
[ "--server", "-S", GetoptLong::REQUIRED_ARGUMENT ],
[ "--single", "-s", GetoptLong::NO_ARGUMENT ],
@@ -363,6 +371,8 @@ if __FILE__ == $0 then
ENV["VERBOSE"] = "1"
when "--flush":
ENV["FLUSH"] = "1"
+ when "--logfile":
+ $LOGFILE = arg
when "--repeat":
ENV["REPEAT"] = arg
when "--server":
@@ -414,7 +424,7 @@ if __FILE__ == $0 then
#
# Create the object
#
- worker = Custodian.new( $SERVER )
+ worker = Custodian.new( $SERVER, $LOGFILE )
#
# Are we flushing the queue?