diff options
-rwxr-xr-x | sbin/spark-daemon.sh | 10 |
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 |