Update README for archival
[reddit.git] / scripts / manage-consumers
blobc17baf7b73923753884adfccc0ae5867a46ac833
1 #!/bin/bash
3 command=${UPSTART_JOB#reddit-consumers-}
4 for consumerpath in $REDDIT_CONSUMER_CONFIG/*; do
5 consumer=$(basename $consumerpath)
7 # allow targeting which consumer the event is meant for (defaulting to 'all')
8 if [ ! -z "$TARGET" -a "x$TARGET" != "xall" -a "x$TARGET" != "x$consumer" ]; then
9 continue
12 if [ -d $consumerpath ]; then
13 types=$consumerpath/*
14 else
15 types=$consumerpath
18 for typepath in $types; do
19 instance_count=$(cat $typepath)
20 type_=$(basename $typepath)
22 for i in $(seq 1 "$instance_count"); do
23 "/sbin/$command" "reddit-consumer-$consumer" "type=$type_" "x=$i"
24 done
25 done
26 done