update the shell script 84/78084/1
authorsunil unnava <sunil.unnava@att.com>
Thu, 7 Feb 2019 18:57:01 +0000 (13:57 -0500)
committersunil unnava <sunil.unnava@att.com>
Thu, 7 Feb 2019 18:57:27 +0000 (13:57 -0500)
Issue-ID: DMAAP-909
Change-Id: If2148445006a2c412bec1e42bb9b519b5d5ae527
Signed-off-by: sunil unnava <sunil.unnava@att.com>
src/main/java/org/onap/dmaap/mr/dmaapMMAgent/utils/MirrorMakerProcessHandler.java

index 9fe80db..114d1f8 100644 (file)
@@ -45,7 +45,7 @@ public class MirrorMakerProcessHandler {
                        } else {
                                //String args[] = { "/bin/sh", "-c", "ps -ef |grep java |grep agentname=" + agentname + "~" };
                                
-                               String args[] = { "/bin/sh", "-c", "ps -ef | grep `ps -ef |grep agentname=" + agentname + "~ | egrep -v 'grep|java' | awk '{print $2}' `| egrep -v '/bin/sh|grep' "};
+                               String args[] = { "/bin/sh", "-c", "ps -ef |grep agentname=" + agentname + "| grep -v grep | awk '{print $1}'"};
                                logger.info("CheckMM process->"+args[2]);
                                mmprocess = rt.exec(args);
                        }
@@ -118,7 +118,7 @@ public class MirrorMakerProcessHandler {
                                //String args[] = { "/bin/sh", "-c",
                                //              "kill -9 `ps -ef |grep agentname=" + agentname + "~| egrep -v 'grep|java' | awk '{print $2}'` | egrep -v '/bin/sh|grep'"};
                                String args[] = { "/bin/sh", "-c",
-                                               "for i in `ps -ef |grep agentname="+ agentname + "~ | egrep -v 'grep|java' | awk '{print $2}'`;do kill -9 `ps -eaf | grep $i | egrep -v '/bin/sh|grep' | awk '{print $2}'` ;done"};
+                                               "kill -9 $(ps -ef | grep agentname=" + agentname + "| grep -v grep | awk '{print $1}')"};
                                logger.info ("Stop MM ->"+args[2]);                             
                                // args = "kill $(ps -ef |grep java |grep agentname=" +
                                // agentname + "~| awk '{print $2}')";
@@ -170,9 +170,9 @@ public class MirrorMakerProcessHandler {
                        } else {
                                String args[] = { "/bin/sh", "-c",
                                                kafkaHome + "/bin/kafka-run-class.sh -Dagentname=" + agentName
-                                                               + "~ kafka.tools.MirrorMaker --consumer.config " + consumerConfig
-                                                               + " --producer.config " + producerConfig + " --num.streams " + numStreams + "  --abort.on.send.failure true" + " --whitelist '" + whitelist + "' >"
-                                                               + mmagenthome + "/logs/" + agentName + "_MMaker.log 2>&1" };
+                                               + " kafka.tools.MirrorMaker --consumer.config " + consumerConfig
+                                               + " --producer.config " + producerConfig + " --num.streams " + numStreams + "  --abort.on.send.failure true" + " --whitelist '" + whitelist + "' 2>&1 >"
+                                               + mmagenthome + "/logs/" + agentName + "_MMaker.log " };
                                final Process process = rt.exec(args);
                                new Thread() {
                                        public void run() {

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use