From d50494656c6a1b73b0c0c95d848f521bf4f827cf Mon Sep 17 00:00:00 2001 From: Daniel Alex Finkelstein Date: Sun, 30 Dec 2012 11:27:29 -0500 Subject: [PATCH 1/2] Added ~/.br.hosts preference to default hosts option --- br | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/br b/br index 4393d83..b2596a1 100755 --- a/br +++ b/br @@ -13,7 +13,7 @@ showhelp() { echo "Usage: `basename $1`: [-m host1 [host2...]] [-c column] [-r reduce] [-i input] [-o output]" echo "bashreduce. Map an input file to many hosts, sort/reduce, merge" echo " -m: hosts to use, can repeat hosts for multiple cores" - echo " default hosts from /etc/br.hosts" + echo " default hosts from ~/.br.hosts or /etc/br.hosts" echo " -c: column to partition, default = 1 (1-based)" echo " -r: reduce function, default = identity" echo " -i: input file, default = stdin" @@ -47,10 +47,12 @@ while getopts "m:c:r:i:o:t:S:h" name; do done if [ -z $hosts ]; then - if [ -e /etc/br.hosts ]; then + if [ -e $HOME/.br.hosts ]; then + hosts=`cat $HOME/.br.hosts` + else if [ -e /etc/br.hosts ]; then hosts=`cat /etc/br.hosts` else - echo "`basename $0`: must specify hosts with -m or provide /etc/br.hosts" + echo "`basename $0`: must specify hosts with -m or provide ~/.br.hosts or /etc/br.hosts" usage $0 fi fi From 47bbac992b1879ebc3f73d8a7b9d77abfb04de1c Mon Sep 17 00:00:00 2001 From: Daniel Alex Finkelstein Date: Sun, 30 Dec 2012 11:28:16 -0500 Subject: [PATCH 2/2] Added ~/.br.hosts preference to default hosts option in readme --- README.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.textile b/README.textile index 33d8c5e..52b29c6 100644 --- a/README.textile +++ b/README.textile @@ -8,7 +8,7 @@ bashreduce lets you apply your favorite unix tools in a mapreduce fashion across h2. Configuration -Edit @/etc/br.hosts@ and enter the machines you wish to use as workers. Or specify your machines at runtime: +Edit @~/.br.hosts@ and/or @/etc/br.hosts@ and enter the machines you wish to use as workers. Or specify your machines at runtime:
br -m "host1 host2 host3"