From 7c10cbf8d97713d258d02b6714e015530a71b227 Mon Sep 17 00:00:00 2001 From: xue_meng_en <1836611252@qq.com> Date: Sun, 13 Nov 2022 21:46:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81:=E5=90=AF?= =?UTF-8?q?=E5=8A=A8monitor=E4=B9=8B=E5=89=8D=E6=9D=80=E6=AD=BB=E6=AE=8B?= =?UTF-8?q?=E7=95=99=E7=9A=84monitor=E8=BF=9B=E7=A8=8B=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8Dagent=E6=97=A0=E6=B3=95=E5=90=AF=E5=8A=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/cm_tool/InstallImpl.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tool/cm_tool/InstallImpl.py b/tool/cm_tool/InstallImpl.py index cdfbd9a..94a7485 100644 --- a/tool/cm_tool/InstallImpl.py +++ b/tool/cm_tool/InstallImpl.py @@ -199,6 +199,9 @@ class InstallImpl: # set crontab on other hosts setCronCmd = "crontab %s" % cronContentTmpFile cleanTmpFileCmd = "rm %s -f" % cronContentTmpFile + import getpass + username = getpass.getuser() + killMonitorCmd = "pkill om_monitor -u %s; " % username for host in self.hostnames: if host == self.localhostName: continue @@ -219,7 +222,8 @@ class InstallImpl: self.logger.logExit(ErrorCode.GAUSS_508["GAUSS_50801"] + errorDetail) # start om_monitor - status, output = self.executeCmdOnHost(host, startMonitorCmd) + # Firstly, kill residual om_monitor, otherwise cm_agent won't be started if there are residual om_monitor process. + status, output = self.executeCmdOnHost(host, killMonitorCmd + startMonitorCmd) if status != 0: self.logger.debug("Command: " + startMonitorCmd) errorDetail = "\nStatus: %s\nOutput: %s" % (status, output) @@ -233,7 +237,7 @@ class InstallImpl: self.logger.logExit(ErrorCode.GAUSS_508["GAUSS_50801"] + errorDetail) os.remove(cronContentTmpFile) - status, output = subprocess.getstatusoutput(startMonitorCmd) + status, output = subprocess.getstatusoutput(killMonitorCmd + startMonitorCmd) if status != 0: self.logger.debug("Command: " + startMonitorCmd) errorDetail = "\nStatus: %s\nOutput: %s" % (status, output)