[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 <WeichenXu123@outlook.com>

Closes #13172 from WeichenXu123/fix-spark-15203.
This commit is contained in:
WeichenXu 2016-05-20 08:17:19 -05:00 committed by Sean Owen
parent 4e73933118
commit a3ceb875c6

View file

@ -162,6 +162,16 @@ run_command() {
esac esac
echo "$newpid" > "$pid" 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 sleep 2
# Check if the process has died; in that case we'll tail the log so the user can see # 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 if [[ ! $(ps -p "$newpid" -o comm=) =~ "java" ]]; then