def run_one_file_name_list(path, file_name_list): for item in file_name_list: process_name = item + '.py' if process_exit(process_name) == 0: # 如果对应的脚本没有在运行, 则运行之 os.system('cd {0} && python3 {1}.py'.format(path, item)) sleep(2.5) # 避免同时先后启动先sleep下 else: print(process_name + '脚本已存在!')
def run_one_file_name_list(path, file_name_list): for item in file_name_list: if item in night_run_file_name_list \ and str(get_shanghai_time())[11:13] not in night_run_time: print('{0}.py不在运行时间点...此处跳过!'.format(item)) pass else: process_name = item + '.py' if process_exit(process_name) == 0: # 如果对应的脚本没有在运行, 则运行之 os.system('cd {0} && python3 {1}.py'.format(path, item)) sleep(2.5) # 避免同时先后启动先sleep下 else: print(process_name + '脚本已存在!')