mirror of https://github.com/jumpserver/jumpserver
perf: 优化启动速度
parent
11a58dc7ad
commit
9d80abadd8
|
@ -44,9 +44,12 @@ class BaseService(object):
|
||||||
if self.is_running:
|
if self.is_running:
|
||||||
msg = f'{self.name} is running: {self.pid}.'
|
msg = f'{self.name} is running: {self.pid}.'
|
||||||
else:
|
else:
|
||||||
msg = '\033[31m{} is stopped.\033[0m\nYou can manual start it to find the error: \n' \
|
msg = f'{self.name} is stopped.'
|
||||||
' $ cd {}\n' \
|
if DEBUG:
|
||||||
' $ {}'.format(self.name, self.cwd, ' '.join(self.cmd))
|
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)
|
print(msg)
|
||||||
|
|
||||||
# -- log --
|
# -- log --
|
||||||
|
@ -147,7 +150,6 @@ class BaseService(object):
|
||||||
self.remove_pid()
|
self.remove_pid()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
time.sleep(1)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def watch(self):
|
def watch(self):
|
||||||
|
@ -203,4 +205,3 @@ class BaseService(object):
|
||||||
logging.info(f'Remove old log: {to_delete_dir}')
|
logging.info(f'Remove old log: {to_delete_dir}')
|
||||||
shutil.rmtree(to_delete_dir, ignore_errors=True)
|
shutil.rmtree(to_delete_dir, ignore_errors=True)
|
||||||
# -- end action --
|
# -- end action --
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,8 @@ class ServicesUtil(object):
|
||||||
service: BaseService
|
service: BaseService
|
||||||
service.start()
|
service.start()
|
||||||
self.files_preserve_map[service.name] = service.log_file
|
self.files_preserve_map[service.name] = service.log_file
|
||||||
time.sleep(1)
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
for service in self._services:
|
for service in self._services:
|
||||||
|
|
Loading…
Reference in New Issue