diff --git a/apps/common/management/commands/services/services/base.py b/apps/common/management/commands/services/services/base.py index 870014474..ddcb4feca 100644 --- a/apps/common/management/commands/services/services/base.py +++ b/apps/common/management/commands/services/services/base.py @@ -44,9 +44,12 @@ class BaseService(object): if self.is_running: msg = f'{self.name} is running: {self.pid}.' else: - 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)) + msg = f'{self.name} is stopped.' + if DEBUG: + 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 -- @@ -147,7 +150,6 @@ class BaseService(object): self.remove_pid() break else: - time.sleep(1) continue def watch(self): @@ -203,4 +205,3 @@ class BaseService(object): logging.info(f'Remove old log: {to_delete_dir}') shutil.rmtree(to_delete_dir, ignore_errors=True) # -- end action -- - diff --git a/apps/common/management/commands/services/utils.py b/apps/common/management/commands/services/utils.py index afa642a1a..7ad6ea7f9 100644 --- a/apps/common/management/commands/services/utils.py +++ b/apps/common/management/commands/services/utils.py @@ -40,7 +40,8 @@ class ServicesUtil(object): service: BaseService service.start() self.files_preserve_map[service.name] = service.log_file - time.sleep(1) + + time.sleep(1) def stop(self): for service in self._services: