From a3ceb875c64421ced8e52db6d8e51aec9b758e3e Mon Sep 17 00:00:00 2001 From: WeichenXu Date: Fri, 20 May 2016 08:17:19 -0500 Subject: [SPARK-15203][DEPLOY] The spark daemon shell script error, daemon process start successfully but script output fail message ## What changes were proposed in this pull request? fix the bug: The spark daemon shell script error, daemon process start successfully but script output fail message ## How was this patch tested? existing test. Author: WeichenXu Closes #13172 from WeichenXu123/fix-spark-15203. --- sbin/spark-daemon.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sbin/spark-daemon.sh b/sbin/spark-daemon.sh index 6ab57df409..5982357112 100755 --- a/sbin/spark-daemon.sh +++ b/sbin/spark-daemon.sh @@ -162,6 +162,16 @@ run_command() { esac echo "$newpid" > "$pid" + + #Poll for up to 5 seconds for the java process to start + for i in {1..10} + do + if [[ $(ps -p "$newpid" -o comm=) =~ "java" ]]; then + break + fi + sleep 0.5 + done + 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 -- cgit v1.2.3