Skip to content

Commit

Permalink
some bash style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
WangTaoTheTonic committed Feb 13, 2015
1 parent 8befee7 commit daa86a1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions sbin/spark-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ case $option in
mkdir -p "$SPARK_PID_DIR"

if [ -f $pid ]; then
TARGET_ID=`cat $pid`
if [[ `ps -p $TARGET_ID -o args=` =~ $command ]]; then
echo $command running as process $TARGET_ID. Stop it first.
TARGET_ID="$(cat "$pid")"
if [[ $(ps -p "$TARGET_ID" -o args=) =~ $command ]]; then
echo "$command running as process $TARGET_ID. Stop it first."
exit 1
fi
fi
Expand All @@ -142,7 +142,7 @@ case $option in
fi

spark_rotate_log "$log"
echo starting $command, logging to $log
echo "starting $command, logging to $log"
if [ $option == spark-submit ]; then
source "$SPARK_HOME"/bin/utils.sh
gatherSparkSubmitOpts "$@"
Expand All @@ -155,7 +155,7 @@ case $option in
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 [[ ! `ps -p $newpid -o args=` =~ $command ]]; then
if [[ ! $(ps -p "$newpid" -o args=) =~ $command ]]; then
echo "failed to launch $command:"
tail -2 "$log" | sed 's/^/ /'
echo "full log in $log"
Expand All @@ -165,15 +165,15 @@ case $option in
(stop)

if [ -f $pid ]; then
TARGET_ID=`cat $pid`
if [[ `ps -p $TARGET_ID -o args=` =~ $command ]]; then
echo stopping $command
kill $TARGET_ID
TARGET_ID="$(cat "$pid")"
if [[ $(ps -p "$TARGET_ID" -o args=) =~ $command ]]; then
echo "stopping $command"
kill "$TARGET_ID"
else
echo no $command to stop
echo "no $command to stop"
fi
else
echo no $command to stop
echo "no $command to stop"
fi
;;

Expand Down

0 comments on commit daa86a1

Please sign in to comment.