From 2705c38ba1568927c70e67298f04ecee388f1cab Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 7 Nov 2022 10:47:06 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E6=B7=BB=E5=8A=A0=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=A4=B1=E8=B4=A5=20debug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/management/commands/services/services/base.py | 4 +++- apps/common/management/commands/services/utils.py | 1 - apps/jumpserver/api.py | 1 - apps/terminal/startup.py | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/common/management/commands/services/services/base.py b/apps/common/management/commands/services/services/base.py index 7b36c9723..870014474 100644 --- a/apps/common/management/commands/services/services/base.py +++ b/apps/common/management/commands/services/services/base.py @@ -44,7 +44,9 @@ class BaseService(object): if self.is_running: msg = f'{self.name} is running: {self.pid}.' else: - msg = f'{self.name} is stopped.' + msg = '\033[31m{} is stopped.\033[0m\nYou can manual start it to find the error: \n' \ + ' $ cd {}\n' \ + ' $ {}'.format(self.name, self.cwd, ' '.join(self.cmd)) print(msg) # -- log -- diff --git a/apps/common/management/commands/services/utils.py b/apps/common/management/commands/services/utils.py index a5c34d770..afa642a1a 100644 --- a/apps/common/management/commands/services/utils.py +++ b/apps/common/management/commands/services/utils.py @@ -76,7 +76,6 @@ class ServicesUtil(object): def clean_up(self): if not self.EXIT_EVENT.is_set(): self.EXIT_EVENT.set() - self.stop() def show_status(self): diff --git a/apps/jumpserver/api.py b/apps/jumpserver/api.py index de51d059c..59580d178 100644 --- a/apps/jumpserver/api.py +++ b/apps/jumpserver/api.py @@ -332,7 +332,6 @@ class HealthCheckView(HealthApiMixin): return False, str(e) def get(self, request): - start = time.time() redis_status, redis_time = self.get_redis_status() db_status, db_time = self.get_db_status() status = all([redis_status, db_status]) diff --git a/apps/terminal/startup.py b/apps/terminal/startup.py index 1b4d7a7e8..cc9da471c 100644 --- a/apps/terminal/startup.py +++ b/apps/terminal/startup.py @@ -59,7 +59,6 @@ class BaseTerminal(object): try: status = status_serializer.save() - print("Save status ok: ", status) time.sleep(self.interval) except OperationalError: print("Save status error, close old connections")