aboutsummaryrefslogtreecommitdiff
path: root/bin/spark-daemon.sh
diff options
context:
space:
mode:
authorJoseph E. Gonzalez <joseph.e.gonzalez@gmail.com>2013-09-17 20:56:12 -0700
committerJoseph E. Gonzalez <joseph.e.gonzalez@gmail.com>2013-09-17 20:56:12 -0700
commit8b59fb72c45a64b6b49d79080eaff0f675197086 (patch)
treeccf8cb18477f75930a54903c2547edc3ae9a5eaf /bin/spark-daemon.sh
parenta3fb29938cd61174785722054cc9331360ccccfe (diff)
parent2aff7989ab617f33052098498119886c40794774 (diff)
downloadspark-8b59fb72c45a64b6b49d79080eaff0f675197086.tar.gz
spark-8b59fb72c45a64b6b49d79080eaff0f675197086.tar.bz2
spark-8b59fb72c45a64b6b49d79080eaff0f675197086.zip
Merging latest changes from spark main branch
Diffstat (limited to 'bin/spark-daemon.sh')
-rwxr-xr-xbin/spark-daemon.sh24
1 files changed, 17 insertions, 7 deletions
diff --git a/bin/spark-daemon.sh b/bin/spark-daemon.sh
index a5b88ca785..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"
@@ -85,7 +88,7 @@ TEST_LOG_DIR=$?
if [ "${TEST_LOG_DIR}" = "0" ]; then
rm -f $SPARK_LOG_DIR/.spark_test
else
- chown $SPARK_IDENT_STRING $SPARK_LOG_DIR
+ chown $SPARK_IDENT_STRING $SPARK_LOG_DIR
fi
if [ "$SPARK_PID_DIR" = "" ]; then
@@ -107,7 +110,7 @@ fi
case $startStop in
(start)
-
+
mkdir -p "$SPARK_PID_DIR"
if [ -f $pid ]; then
@@ -122,14 +125,21 @@ 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"/run $command "$@" > "$log" 2>&1 < /dev/null &
- echo $! > $pid
- sleep 1; head "$log"
+ nohup nice -n $SPARK_NICENESS "$SPARK_PREFIX"/spark-class $command "$@" >> "$log" 2>&1 < /dev/null &
+ 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)
if [ -f $pid ]; then