Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add script for starting/restarting queue consumer jobs.

  • Loading branch information...
commit 5c80560e51db7d0f0d45df0b26ff30372d675182 1 parent 2028bc4
@spladug spladug authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 scripts/manage-consumers
View
19 scripts/manage-consumers
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+command=${UPSTART_JOB#reddit-consumers-}
+while read consumer instance_count; do
+ # blank lines in the file should be ignored
+ if [ -z "$consumer" ]; then
+ continue
+ fi
+
+ # allow targeting which consumer the event is meant for (defaulting to 'all')
+ if [ ! -z "$TARGET" -a "x$TARGET" != "xall" -a "x$TARGET" != "x$consumer" ]; then
+ continue
+ fi
+
+ for i in $(seq 1 "$instance_count"); do
+ "/sbin/$command" "reddit-consumer-$consumer" "x=$i"
+ done
+done < "$REDDIT_CONSUMER_CONFIG"
+
Please sign in to comment.
Something went wrong with that request. Please try again.