aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorWeichenXu <WeichenXu123@outlook.com>2016-05-20 08:17:19 -0500
committerSean Owen <sowen@cloudera.com>2016-05-20 08:17:19 -0500
commita3ceb875c64421ced8e52db6d8e51aec9b758e3e (patch)
tree2638282c8ecf88f0dd06de61c068953eef391981 /sbin
parent4e739331187f2acdd84a5e65857edb62e58a0f8f (diff)
downloadspark-a3ceb875c64421ced8e52db6d8e51aec9b758e3e.tar.gz
spark-a3ceb875c64421ced8e52db6d8e51aec9b758e3e.tar.bz2
spark-a3ceb875c64421ced8e52db6d8e51aec9b758e3e.zip
[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.
Diffstat (limited to 'sbin')
-rwxr-xr-xsbin/spark-daemon.sh10
1 files changed, 10 insertions, 0 deletions
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