Browse files

Add script for starting/restarting queue consumer jobs.

  • Loading branch information...
1 parent 2028bc4 commit 5c80560e51db7d0f0d45df0b26ff30372d675182 @spladug spladug committed May 31, 2012
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"
+

0 comments on commit 5c80560

Please sign in to comment.