aboutsummaryrefslogtreecommitdiff
path: root/bin/spark-daemon.sh
diff options
context:
space:
mode:
authorMatei Zaharia <matei@eecs.berkeley.edu>2013-08-31 17:31:07 -0700
committerMatei Zaharia <matei@eecs.berkeley.edu>2013-08-31 17:31:07 -0700
commit2ee6a7e32aaf6dbe81ea79bee1228bb09e48dd1a (patch)
tree7f5c24445a1b8579777368a4d0c8794913496c71 /bin/spark-daemon.sh
parent25ac50668bf6ec278c9b19ff24e907eaf010399f (diff)
downloadspark-2ee6a7e32aaf6dbe81ea79bee1228bb09e48dd1a.tar.gz
spark-2ee6a7e32aaf6dbe81ea79bee1228bb09e48dd1a.tar.bz2
spark-2ee6a7e32aaf6dbe81ea79bee1228bb09e48dd1a.zip
Print output from spark-daemon only when it fails to launch
Diffstat (limited to 'bin/spark-daemon.sh')
-rwxr-xr-xbin/spark-daemon.sh16
1 files changed, 13 insertions, 3 deletions
diff --git a/bin/spark-daemon.sh b/bin/spark-daemon.sh
index f01ff84d95..5bfe967fbf 100755
--- a/bin/spark-daemon.sh
+++ b/bin/spark-daemon.sh
@@ -75,6 +75,9 @@ if [ "$SPARK_IDENT_STRING" = "" ]; then
export SPARK_IDENT_STRING="$USER"
fi
+
+export SPARK_PRINT_LAUNCH_COMMAND="1"
+
# get log directory
if [ "$SPARK_LOG_DIR" = "" ]; then
export SPARK_LOG_DIR="$SPARK_HOME/logs"
@@ -122,12 +125,19 @@ case $startStop in
rsync -a -e ssh --delete --exclude=.svn --exclude='logs/*' --exclude='contrib/hod/logs/*' $SPARK_MASTER/ "$SPARK_HOME"
fi
- spark_rotate_log $log
+ spark_rotate_log "$log"
echo starting $command, logging to $log
cd "$SPARK_PREFIX"
nohup nice -n $SPARK_NICENESS "$SPARK_PREFIX"/spark-class $command "$@" >> "$log" 2>&1 < /dev/null &
- echo $! > $pid
- sleep 1; head "$log"
+ newpid=$!
+ echo $newpid > $pid
+ sleep 2
+ # Check if the process has died; in that case we'll tail the log so the user can see
+ if ! kill -0 $newpid >/dev/null 2>&1; then
+ echo "failed to launch $command:"
+ tail -2 "$log" | sed 's/^/ /'
+ echo "full log in $log"
+ fi
;;
(stop)