[ https://issues.apache.org/jira/browse/TRAFODION-1609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353036#comment-15353036 ]
ASF GitHub Bot commented on TRAFODION-1609: ------------------------------------------- Github user selvaganesang commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/562#discussion_r68762512 --- Diff: core/sqf/sql/scripts/install_local_hadoop --- @@ -847,20 +847,31 @@ EOF cat <<EOF >$MY_SW_SCRIPTS_DIR/swstatus #!/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\` +cd \${MY_SW_ROOT} +. \$MY_SW_SCRIPTS_DIR/sw_env.sh +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 --- End diff -- See Line numbers 777 and above of this file. It has scripts like swstartall, swstopall, swstarthbase, swstophbase etc. > Change swstatus to give a simple "up" or "down" answer, instead of the > current, confusing display > ------------------------------------------------------------------------------------------------- > > Key: TRAFODION-1609 > URL: https://issues.apache.org/jira/browse/TRAFODION-1609 > Project: Apache Trafodion > Issue Type: Improvement > Components: sql-general > Reporter: Hans Zeller > Assignee: Eason Zhang > Priority: Minor > > The "swstatus" script used in cases where we did install_local_hadoop counts > the MySQL processes and then simply invokes jps. > It would be better if the script would check specifically for HMaster, > NameNode, DataNode and maybe others, like NodeManager and ResourceManager. If > any are missing, it should print out which ones are missing, otherwise it > should just say something like "processes are up". > It should also return an exit code of 0 if everything is up and 1 if some > processes are missing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)