31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
import json
|
|
from datetime import datetime, timezone, timedelta
|
|
|
|
d = json.load(open('/home/hmo/.hermes/profiles/position-analyst/cron/jobs.json'))
|
|
jobs = d if isinstance(d, list) else d.get('jobs', [])
|
|
now = datetime.now(timezone.utc)
|
|
print(f"{'name':32} {'last_run':20} {'status':8} {'next_run':20} {'en'}")
|
|
print('-' * 95)
|
|
for j in sorted(jobs, key=lambda x: x.get('last_run_at') or ''):
|
|
if not j.get('enabled', True):
|
|
continue
|
|
lr = (j.get('last_run_at') or '?')[:19]
|
|
nr = (j.get('next_run_at') or '?')[:19]
|
|
st = str(j.get('last_status', '?'))
|
|
print(f"{j.get('name','?')[:32]:32} {lr:20} {st:8} {nr:20} {j.get('enabled')}")
|
|
|
|
# also check gateway-side cron (default profile)
|
|
print()
|
|
print('=== default profile cron ===')
|
|
try:
|
|
d2 = json.load(open('/home/hmo/.hermes/cron/jobs.json'))
|
|
jobs2 = d2 if isinstance(d2, list) else d2.get('jobs', [])
|
|
for j in sorted(jobs2, key=lambda x: x.get('last_run_at') or ''):
|
|
if not j.get('enabled', True):
|
|
continue
|
|
lr = (j.get('last_run_at') or '?')[:19]
|
|
nr = (j.get('next_run_at') or '?')[:19]
|
|
st = str(j.get('last_status', '?'))
|
|
print(f"{j.get('name','?')[:32]:32} {lr:20} {st:8} {nr:20} {j.get('enabled')}")
|
|
except Exception as e:
|
|
print('err:', e) |