Files
reddit/scripts/manage-consumers
2012-05-31 15:57:57 -07:00

20 lines
538 B
Bash
Executable File

#!/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"