[Update] 修改启动脚本

pull/3313/head
ibuler 2019-10-08 19:14:23 +08:00
parent 6b377ec5ef
commit 87d5b6c473
1 changed files with 9 additions and 5 deletions

14
jms
View File

@ -100,7 +100,7 @@ def collect_static():
os.chdir(os.path.join(BASE_DIR, 'apps')) os.chdir(os.path.join(BASE_DIR, 'apps'))
command = 'python3 manage.py collectstatic --no-input -c &> /dev/null ' command = 'python3 manage.py collectstatic --no-input -c &> /dev/null '
subprocess.call(command, shell=True) subprocess.call(command, shell=True)
logging.info("Collect static file done") logging.info("Collect static files done")
def prepare(): def prepare():
@ -292,11 +292,12 @@ def watch_services():
p.wait(timeout=1) p.wait(timeout=1)
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
pass pass
if p.returncode is not None: ok = is_running(s)
if not ok:
stopped_services[s] = '' stopped_services[s] = ''
print("stopped") print("stopped with code: {}({})".format(p.returncode, p.pid))
else: else:
print("running") print("running at {}".format(p.pid))
stopped_services.pop(s, None) stopped_services.pop(s, None)
services_retry.pop(s, None) services_retry.pop(s, None)
@ -320,7 +321,10 @@ def watch_services():
if tm != '23:59': if tm != '23:59':
return return
suffix = now.strftime('%Y-%m-%d') suffix = now.strftime('%Y-%m-%d')
for s in processes: services = list(processes.keys())
services.append('jms')
for s in services:
log_path = get_log_file_path(s) log_path = get_log_file_path(s)
log_dir = os.path.dirname(log_path) log_dir = os.path.dirname(log_path)
filename = os.path.basename(log_path) filename = os.path.basename(log_path)