summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2013-04-23 10:11:47 +0100
committerSteve Kemp <steve@steve.org.uk>2013-04-23 10:11:47 +0100
commit521970d92aa9341de76eff1086bca1bea0675665 (patch)
treee36253837ad2f3af453fe1252ab101af9b951af5 /bin
parent97f6b74a74c02e8aae6ae06894445d2a8f59a545 (diff)
Allow --queue to specify the beanstalkd tube.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/custodian-dequeue7
-rwxr-xr-xbin/custodian-enqueue11
-rwxr-xr-xbin/custodian-queue6
3 files changed, 20 insertions, 4 deletions
diff --git a/bin/custodian-dequeue b/bin/custodian-dequeue
index 08579af..f121686 100755
--- a/bin/custodian-dequeue
+++ b/bin/custodian-dequeue
@@ -71,15 +71,18 @@ if __FILE__ == $0 then
#
settings = Custodian::Settings.instance()
$SERVER = settings.queue_server
+ $QUEUE = settings.queue_name
$ALERTER = settings.alerter
$LOGFILE = settings.log_file
+
begin
opts = GetoptLong.new(
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
[ "--manual", "-m", GetoptLong::NO_ARGUMENT ],
[ "--fail", "-f", GetoptLong::NO_ARGUMENT ],
[ "--logfile", "-l", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--queue", "-q", GetoptLong::REQUIRED_ARGUMENT ],
[ "--server", "-S", GetoptLong::REQUIRED_ARGUMENT ],
[ "--alerter", "-a", GetoptLong::REQUIRED_ARGUMENT ],
[ "--single", "-s", GetoptLong::NO_ARGUMENT ],
@@ -93,6 +96,8 @@ if __FILE__ == $0 then
$LOGFILE = arg
when "--server" then
$SERVER = arg
+ when "--queue" then
+ $QUEUE = arg
when "--alerter" then
$ALERTER = arg
when "--single" then
@@ -144,7 +149,7 @@ if __FILE__ == $0 then
#
# Create the object
#
- worker = Custodian::Worker.new( $SERVER, $ALERTER, $LOGFILE, settings )
+ worker = Custodian::Worker.new( $SERVER, $QUEUE, $ALERTER, $LOGFILE, settings )
#
diff --git a/bin/custodian-enqueue b/bin/custodian-enqueue
index 41378e6..e2e4420 100755
--- a/bin/custodian-enqueue
+++ b/bin/custodian-enqueue
@@ -6,6 +6,7 @@
# SYNOPSIS
# custodian-enqueue [ -h | --help ]
# [ -m | --manual]
+# [ -q | --queue NAME]
# [ -f | --file FILE]
# [ -d | --dump ]
# [ | --test ]
@@ -18,6 +19,8 @@
#
# -d, --dump Dump the parsed tests to the console; don't insert in the queue.
#
+# -q, --queue Use the named beanstalkd tube.
+#
# --test Test the parsing of the given file, alert on errors.
#
# -f, --file FILE Parse the given configuration file.
@@ -74,6 +77,7 @@ if __FILE__ == $0 then
#
settings = Custodian::Settings.instance()
$SERVER = settings.queue_server
+ $QUEUE = settings.queue_name
begin
opts = GetoptLong.new(
@@ -82,6 +86,7 @@ if __FILE__ == $0 then
[ "--server", GetoptLong::REQUIRED_ARGUMENT ],
[ "--file", "-f", GetoptLong::REQUIRED_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
+ [ "--queue", "-q", GetoptLong::REQUIRED_ARGUMENT ],
[ "--manual","-m", GetoptLong::NO_ARGUMENT ]
)
opts.each do |opt, arg|
@@ -92,7 +97,9 @@ if __FILE__ == $0 then
ENV["TEST"] = "1"
when "--server" then
$SERVER = arg
- when "--file" then
+ when "--queue" then
+ $QUEUE= arg
+ when "--file" then
ENV["FILE"] = arg
when "--help" then
$help = true
@@ -139,7 +146,7 @@ if __FILE__ == $0 then
#
# Connected to the server
#
- queue = Beanstalk::Pool.new([$SERVER], "Custodian")
+ queue = Beanstalk::Pool.new([$SERVER], $QUEUE )
if ( ! queue )
puts "Failed to connect to beanstalk server: #{$SERVER}"
exit 1
diff --git a/bin/custodian-queue b/bin/custodian-queue
index f50a9bd..3e20410 100755
--- a/bin/custodian-queue
+++ b/bin/custodian-queue
@@ -69,6 +69,7 @@ if __FILE__ == $0 then
#
settings = Custodian::Settings.instance()
$SERVER = settings.queue_server
+ $QUEUE = settings.queue_name
begin
opts = GetoptLong.new(
@@ -77,6 +78,7 @@ if __FILE__ == $0 then
[ "--manual", "-m", GetoptLong::NO_ARGUMENT ],
[ "--monitor", "-M", GetoptLong::OPTIONAL_ARGUMENT ],
[ "--server", "-S", GetoptLong::REQUIRED_ARGUMENT ],
+ [ "--queue", "-q", GetoptLong::REQUIRED_ARGUMENT ],
[ "--stats", "-s", GetoptLong::NO_ARGUMENT ]
)
opts.each do |opt, arg|
@@ -93,6 +95,8 @@ if __FILE__ == $0 then
$FLUSH = true
when "--server" then
$SERVER = arg
+ when "--queue" then
+ $QUEUE = arg
when "--help" then
$help = true
when "--manual" then
@@ -136,7 +140,7 @@ if __FILE__ == $0 then
#
# Create the queue object.
#
- queue = Beanstalk::Pool.new([$SERVER], "Custodian" )
+ queue = Beanstalk::Pool.new([$SERVER], $QUEUE )
#
# Alerting on a queue that is too-full?