Repository: incubator-trafodion Updated Branches: refs/heads/master c27dc0a53 -> e8017273e
[TRAFODION-1609] Change swstatus to give a simple "up" or "down" answer, instead of the current, confusing display Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/0e9f43aa Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/0e9f43aa Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/0e9f43aa Branch: refs/heads/master Commit: 0e9f43aa18f1984fd1e6c07ddb0c95ecfe84211d Parents: 7ad34b1 Author: Eason <[email protected]> Authored: Mon Jun 27 14:40:07 2016 +0800 Committer: GitHub <[email protected]> Committed: Mon Jun 27 14:40:07 2016 +0800 ---------------------------------------------------------------------- core/sqf/sql/scripts/install_local_hadoop | 29 ++++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0e9f43aa/core/sqf/sql/scripts/install_local_hadoop ---------------------------------------------------------------------- diff --git a/core/sqf/sql/scripts/install_local_hadoop b/core/sqf/sql/scripts/install_local_hadoop index a5c8c54..87d8dfe 100755 --- a/core/sqf/sql/scripts/install_local_hadoop +++ b/core/sqf/sql/scripts/install_local_hadoop @@ -849,18 +849,29 @@ EOF #!/bin/sh cd ${MY_SW_ROOT} . $MY_SW_SCRIPTS_DIR/sw_env.sh -NUM_JAVA_PROCS=\`ps -aef | grep \$USER | grep java | grep -v grep | wc -l\` -NUM_MYSQLD_PROCS=\`ps -aef | grep \$USER | grep mysqld | grep -v grep | wc -l\` +JPS_OUTPUT=`jps` +SERVICES='HMaster NodeManager ResourceManager NameNode DataNode SecondaryNameNode' +for s in $SERVICES; do + if [[ ! $JPS_OUTPUT =~ $s ]]; then + MISS_SERVICE="$s $MISS_SERVICE" + fi +done -if [ "\$1" == "-v" ]; then - ps -aef | grep \$USER | grep java | grep -v grep - ps -aef | grep \$USER | grep mysqld | grep -v grep +if [[ $MISS_SERVICE != '' ]]; then + echo "ERROR: Service \"$MISS_SERVICE\" are not up!" + exit 1 +else + echo "The local hadoop services are up!" fi -echo "\$NUM_JAVA_PROCS java servers and \$NUM_MYSQLD_PROCS mysqld processes are running" - -jps | grep -v Jps - +NUM_MYSQLD_PROCS=`ps -aef | grep $USER | grep mysqld | grep -v grep | wc -l` +if [[ $NUM_MYSQLD_PROCS -ne 0 ]]; then + echo "$NUM_MYSQLD_PROCS mysqld processes are running" + exit 0 +else + echo "ERROR: mysqld process is not running!" + exit 1 +fi EOF #######################################################
