From 5e80e13dcbca09767412a346955a2dd331ccbd0b Mon Sep 17 00:00:00 2001 From: xue_meng_en <1836611252@qq.com> Date: Tue, 1 Nov 2022 11:24:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=B8=E8=BD=BDCM=E6=9C=AA?= =?UTF-8?q?=E6=B8=85=E7=90=86=E5=AE=8C=E5=85=A8CM=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/cm_tool/cm_uninstall | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tool/cm_tool/cm_uninstall b/tool/cm_tool/cm_uninstall index 1ff8ad3..b5e110c 100644 --- a/tool/cm_tool/cm_uninstall +++ b/tool/cm_tool/cm_uninstall @@ -204,15 +204,16 @@ General options: if not self.bDeleteData: return self.logger.log("Deleting CM data path.") + self.logger.closeLog() for host, path in zip(self.hostnames, self.cmDataPaths): isLocal = False if host == self.localhostName: isLocal = True - cmd = "source %s; rm -rf %s" % (self.envFile, path) + cmd = "source %s; rm -rf %s $GAUSSLOG/cm" % (self.envFile, path) status, output = executeCmdOnHost(host, cmd, isLocal) if status != 0: errorDetail = "\nCommand: %s\nStatus: %s\nOutput: %s" % (cmd, status, output) - self.logger.exitWithError(("Failed to delete CM data path on host %s." % host) + errorDetail) + CMLog.exitWithError(("Failed to delete CM data path on host %s." % host) + errorDetail) def deleteBinary(self): """ @@ -225,11 +226,12 @@ General options: isLocal = False if host == self.localhostName: isLocal = True - cmd = "source %s; cd $GAUSSHOME/bin; rm -f om_monitor cm_agent cm_server cm_ctl; cd -" % self.envFile + cmd = "source %s; cd $GAUSSHOME/bin; rm -f om_monitor* cm_agent* cm_server* " \ + "cm_ctl* *manual*start*; cd -" % self.envFile status, output = executeCmdOnHost(host, cmd, isLocal) if status != 0: errorDetail = "\nCommand: %s\nStatus: %s\nOutput: %s" % (cmd, status, output) - self.logger.exitWithError(("Failed to delete CM binaries on host %s." % host) + errorDetail) + self.logger.logExit(("Failed to delete CM binaries on host %s." % host) + errorDetail) def initLogger(self): gaussLog = getEnvParam(self.envFile, "GAUSSLOG") @@ -254,11 +256,13 @@ General options: self.cancleMonitorCrontab() self.stopCMProcess() self.refreshStaticAndDynamicFile() - self.deleteData() self.deleteBinary() - self.logger.log("Uninstall CM tool success.") - + self.deleteData() + if self.bDeleteData: + self.logger.printMessage("Uninstall CM tool success.") + else: + self.logger.logExit("Uninstall CM tool success.") if __name__ == "__main__": unInstall = UnIntall() - unInstall.run() \ No newline at end of file + unInstall.run()