From 563645f9fe6e999adc2ee22422cfb236278f3c10 Mon Sep 17 00:00:00 2001 From: Yuming Wang Date: Wed, 30 Nov 2016 18:00:13 +0800 Subject: [PATCH 1/2] Fix Unrecognized option --- sbin/spark-daemon.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sbin/spark-daemon.sh b/sbin/spark-daemon.sh index 061019a55e997..9087892758c24 100755 --- a/sbin/spark-daemon.sh +++ b/sbin/spark-daemon.sh @@ -124,9 +124,8 @@ if [ "$SPARK_NICENESS" = "" ]; then fi execute_command() { - local command="$@" if [ -z ${SPARK_NO_DAEMONIZE+set} ]; then - nohup -- $command >> $log 2>&1 < /dev/null & + nohup -- "$@" >> $log 2>&1 < /dev/null & newpid="$!" echo "$newpid" > "$pid" @@ -143,12 +142,12 @@ execute_command() { sleep 2 # Check if the process has died; in that case we'll tail the log so the user can see if [[ ! $(ps -p "$newpid" -o comm=) =~ "java" ]]; then - echo "failed to launch $command:" + echo "failed to launch: $@" tail -2 "$log" | sed 's/^/ /' echo "full log in $log" fi else - $command + "$@" fi } @@ -176,11 +175,11 @@ run_command() { case "$mode" in (class) - execute_command nice -n "$SPARK_NICENESS" "${SPARK_HOME}"/bin/spark-class $command $@ + execute_command nice -n "$SPARK_NICENESS" "${SPARK_HOME}"/bin/spark-class $command "$@" ;; (submit) - execute_command nice -n "$SPARK_NICENESS" bash "${SPARK_HOME}"/bin/spark-submit --class $command $@ + execute_command nice -n "$SPARK_NICENESS" bash "${SPARK_HOME}"/bin/spark-submit --class $command "$@" ;; (*) From 9f67fd882df955af89744b841f630652d4291e96 Mon Sep 17 00:00:00 2001 From: Yuming Wang Date: Wed, 30 Nov 2016 23:05:09 +0800 Subject: [PATCH 2/2] Quote $command --- sbin/spark-daemon.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/spark-daemon.sh b/sbin/spark-daemon.sh index 9087892758c24..c227c9828e6ac 100755 --- a/sbin/spark-daemon.sh +++ b/sbin/spark-daemon.sh @@ -175,11 +175,11 @@ run_command() { case "$mode" in (class) - execute_command nice -n "$SPARK_NICENESS" "${SPARK_HOME}"/bin/spark-class $command "$@" + execute_command nice -n "$SPARK_NICENESS" "${SPARK_HOME}"/bin/spark-class "$command" "$@" ;; (submit) - execute_command nice -n "$SPARK_NICENESS" bash "${SPARK_HOME}"/bin/spark-submit --class $command "$@" + execute_command nice -n "$SPARK_NICENESS" bash "${SPARK_HOME}"/bin/spark-submit --class "$command" "$@" ;; (*)