From d2c86e718891b40e1cea8b0719462673b6b64e4e Mon Sep 17 00:00:00 2001 From: KarthikTunga Date: Tue, 15 Oct 2013 00:35:44 -0700 Subject: SPARK-627 - reading --config argument --- bin/slaves.sh | 16 ++++++++++++++++ bin/spark-daemon.sh | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'bin') diff --git a/bin/slaves.sh b/bin/slaves.sh index 752565b759..bcb7760130 100755 --- a/bin/slaves.sh +++ b/bin/slaves.sh @@ -46,6 +46,22 @@ bin=`cd "$bin"; pwd` # spark-env.sh. Save it here. HOSTLIST=$SPARK_SLAVES +#check if conf dir passed as an argument +if [ "$1" == "--config" ] +then + shift + conf_dir=$1 + if [ ! -d "$conf_dir" ] + then + echo "$conf_dir is not a valid directory" + echo $usage + exit 1 + else + export SPARK_CONF_DIR=$conf_dir + fi + shift +fi + if [ -f "${SPARK_CONF_DIR}/spark-env.sh" ]; then . "${SPARK_CONF_DIR}/spark-env.sh" fi diff --git a/bin/spark-daemon.sh b/bin/spark-daemon.sh index 5bfe967fbf..48d552f3db 100755 --- a/bin/spark-daemon.sh +++ b/bin/spark-daemon.sh @@ -43,6 +43,23 @@ bin=`cd "$bin"; pwd` . "$bin/spark-config.sh" # get arguments + +# check if conf dir passed as an argument +if [ "$1" == "--config" ] +then + shift + conf_dir=$1 + if [ ! -d "$conf_dir" ] + then + echo "$conf_dir is not a valid directory" + echo "FOUL :"$usage + exit 1 + else + export SPARK_CONF_DIR=$conf_dir + fi + shift +fi + startStop=$1 shift command=$1 -- cgit v1.2.3 From a32aa6b351064f17779adcd8e89ebc0e98fc3096 Mon Sep 17 00:00:00 2001 From: KarthikTunga Date: Wed, 16 Oct 2013 22:51:09 -0700 Subject: Implementing --config argument in the scripts --- bin/slaves.sh | 7 ++++--- bin/spark-daemon.sh | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/slaves.sh b/bin/slaves.sh index bcb7760130..aeb0c0f6be 100755 --- a/bin/slaves.sh +++ b/bin/slaves.sh @@ -28,7 +28,7 @@ # SPARK_SSH_OPTS Options passed to ssh when running remote commands. ## -usage="Usage: slaves.sh [--config confdir] command..." +usage="Usage: slaves.sh [--config ] command..." # if no args specified, show usage if [ $# -le 0 ]; then @@ -46,14 +46,15 @@ bin=`cd "$bin"; pwd` # spark-env.sh. Save it here. HOSTLIST=$SPARK_SLAVES -#check if conf dir passed as an argument +# Check if --config is passed as an argument. It is an optional parameter. +# Exit if the argument is a directory. if [ "$1" == "--config" ] then shift conf_dir=$1 if [ ! -d "$conf_dir" ] then - echo "$conf_dir is not a valid directory" + echo "ERROR : $conf_dir is not a directory" echo $usage exit 1 else diff --git a/bin/spark-daemon.sh b/bin/spark-daemon.sh index 48d552f3db..262ef173be 100755 --- a/bin/spark-daemon.sh +++ b/bin/spark-daemon.sh @@ -29,7 +29,7 @@ # SPARK_NICENESS The scheduling priority for daemons. Defaults to 0. ## -usage="Usage: spark-daemon.sh [--config ] [--hosts hostlistfile] (start|stop) " +usage="Usage: spark-daemon.sh [--config ] (start|stop) " # if no args specified, show usage if [ $# -le 1 ]; then @@ -44,15 +44,17 @@ bin=`cd "$bin"; pwd` # get arguments -# check if conf dir passed as an argument +# Check if --config is passed as an argument. It is an optional parameter. +# Exit if the argument is a directory. + if [ "$1" == "--config" ] then shift conf_dir=$1 if [ ! -d "$conf_dir" ] then - echo "$conf_dir is not a valid directory" - echo "FOUL :"$usage + echo "ERROR : $conf_dir is not a directory" + echo $usage exit 1 else export SPARK_CONF_DIR=$conf_dir -- cgit v1.2.3 From ff4fb1f7ee3236f4a6d7fe5b677c11ba593c50c0 Mon Sep 17 00:00:00 2001 From: KarthikTunga Date: Wed, 16 Oct 2013 22:55:15 -0700 Subject: SPARK-627 , Implementing --config arguments in the scripts --- bin/slaves.sh | 2 +- bin/spark-daemon.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/slaves.sh b/bin/slaves.sh index aeb0c0f6be..c367c2fd8e 100755 --- a/bin/slaves.sh +++ b/bin/slaves.sh @@ -47,7 +47,7 @@ bin=`cd "$bin"; pwd` HOSTLIST=$SPARK_SLAVES # Check if --config is passed as an argument. It is an optional parameter. -# Exit if the argument is a directory. +# Exit if the argument is not a directory. if [ "$1" == "--config" ] then shift diff --git a/bin/spark-daemon.sh b/bin/spark-daemon.sh index 262ef173be..a0c0d44b58 100755 --- a/bin/spark-daemon.sh +++ b/bin/spark-daemon.sh @@ -45,7 +45,7 @@ bin=`cd "$bin"; pwd` # get arguments # Check if --config is passed as an argument. It is an optional parameter. -# Exit if the argument is a directory. +# Exit if the argument is not a directory. if [ "$1" == "--config" ] then -- cgit v1.2.3 From 8537f19268bf53e5f154dedb7ba35b711dfbefbd Mon Sep 17 00:00:00 2001 From: KarthikTunga Date: Wed, 16 Oct 2013 23:00:33 -0700 Subject: SPARK-627 , Implementing --config arguments in the scripts --- bin/spark-daemons.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/spark-daemons.sh b/bin/spark-daemons.sh index 354eb905a1..64286cb2da 100755 --- a/bin/spark-daemons.sh +++ b/bin/spark-daemons.sh @@ -19,7 +19,7 @@ # Run a Spark command on all slave hosts. -usage="Usage: spark-daemons.sh [--config confdir] [--hosts hostlistfile] [start|stop] command instance-number args..." +usage="Usage: spark-daemons.sh [--config ] [start|stop] command instance-number args..." # if no args specified, show usage if [ $# -le 1 ]; then -- cgit v1.2.3