You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sr...@apache.org on 2015/04/13 14:03:02 UTC
spark git commit: [SPARK-6671] Add status command for spark daemons
Repository: spark
Updated Branches:
refs/heads/master 9d117cee0 -> 240ea03fa
[SPARK-6671] Add status command for spark daemons
SPARK-6671
Currently using the spark-daemon.sh script we can start and stop the spark demons. But we cannot get the status of the daemons. It will be nice to include the status command in the spark-daemon.sh script, through which we can know if the spark demon is alive or not.
Author: Pradeep Chanumolu <pc...@maprtech.com>
Closes #5327 from pchanumolu/master and squashes the following commits:
d3a1f05 [Pradeep Chanumolu] Make status command check consistent with Stop command
5062926 [Pradeep Chanumolu] Fix indentation in spark-daemon.sh
3e66bc8 [Pradeep Chanumolu] SPARK-6671 : Add status command to spark daemons
1ac3918 [Pradeep Chanumolu] Add status command to spark-daemon
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/240ea03f
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/240ea03f
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/240ea03f
Branch: refs/heads/master
Commit: 240ea03faea005306e73c10253716b95487325ff
Parents: 9d117ce
Author: Pradeep Chanumolu <pc...@maprtech.com>
Authored: Mon Apr 13 13:02:55 2015 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Mon Apr 13 13:02:55 2015 +0100
----------------------------------------------------------------------
sbin/spark-daemon.sh | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/240ea03f/sbin/spark-daemon.sh
----------------------------------------------------------------------
diff --git a/sbin/spark-daemon.sh b/sbin/spark-daemon.sh
index 92e76a3..d8e0fac 100755
--- a/sbin/spark-daemon.sh
+++ b/sbin/spark-daemon.sh
@@ -29,7 +29,7 @@
# SPARK_NICENESS The scheduling priority for daemons. Defaults to 0.
##
-usage="Usage: spark-daemon.sh [--config <conf-dir>] (start|stop) <spark-command> <spark-instance-number> <args...>"
+usage="Usage: spark-daemon.sh [--config <conf-dir>] (start|stop|status) <spark-command> <spark-instance-number> <args...>"
# if no args specified, show usage
if [ $# -le 1 ]; then
@@ -195,6 +195,23 @@ case $option in
fi
;;
+ (status)
+
+ if [ -f $pid ]; then
+ TARGET_ID="$(cat "$pid")"
+ if [[ $(ps -p "$TARGET_ID" -o comm=) =~ "java" ]]; then
+ echo $command is running.
+ exit 0
+ else
+ echo $pid file is present but $command not running
+ exit 1
+ fi
+ else
+ echo $command not running.
+ exit 2
+ fi
+ ;;
+
(*)
echo $usage
exit 1
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org