15 lines
569 B
Python
15 lines
569 B
Python
import json, shutil
|
|
jf = '/home/hmo/.hermes/cron/jobs.json'
|
|
shutil.copy(jf, jf + '.bak-20260720-l134')
|
|
d = json.load(open(jf))
|
|
is_list = isinstance(d, list)
|
|
jobs = d if is_list else d.get('jobs', [])
|
|
REMOVE = {'Cron监护-高频'}
|
|
removed = [j.get('name') for j in jobs if j.get('name') in REMOVE]
|
|
jobs = [j for j in jobs if j.get('name') not in REMOVE]
|
|
if is_list:
|
|
json.dump(jobs, open(jf, 'w'), ensure_ascii=False, indent=2)
|
|
else:
|
|
d['jobs'] = jobs
|
|
json.dump(d, open(jf, 'w'), ensure_ascii=False, indent=2)
|
|
print('removed:', removed, '| total:', len(jobs)) |